namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0002 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AcmChangeValue",
                c => new
                    {
                        AccountChangeId = c.Int(nullable: false, identity: true),
                        AccountCash = c.Int(),
                        AccountCreditorFromCheckReceive = c.Int(),
                        AccountDebtorBorrowCash = c.Int(),
                        AccountWhtTax = c.Int(),
                        AccountVoucherRemainPay = c.Int(),
                        AccountPayBetweenOrg = c.Int(),
                        AccountIncomeBetweenOrg = c.Int(),
                        AccountFineFromCheck = c.Int(),
                        AccountGuranteeResult = c.Int(),
                        AccountWaitReceiveCash = c.Int(),
                        AccountRequestMoneyMoreWaitReturn = c.Int(),
                        AccountGuaranteeEnvelope = c.Int(),
                        AccountGuaranteePromise = c.Int(),
                        AccountGuaranteePayAdvance = c.Int(),
                        AccountSendIncome = c.Int(),
                        AccountIncomeWaitSendStock = c.Int(),
                        AccountCashDepositStock = c.Int(),
                        AccountRemainReceiveOrgAccCenter = c.Int(),
                        LengthAccountCode = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AccountChangeId);
            
            CreateTable(
                "dbo.AcmMasAccount",
                c => new
                    {
                        AccountId = c.Int(nullable: false, identity: true),
                        AccountCode = c.String(),
                        UpperAccountId = c.Int(),
                        AccountName = c.String(),
                        AccountDescr = c.String(),
                        VersionId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AccountId)
                .ForeignKey("dbo.AcmMasAccount", t => t.UpperAccountId)
                .ForeignKey("dbo.AcmMasAccountVersion", t => t.VersionId)
                .Index(t => t.UpperAccountId)
                .Index(t => t.VersionId);
            
            CreateTable(
                "dbo.AcmMasAccountVersion",
                c => new
                    {
                        VersionId = c.Int(nullable: false, identity: true),
                        VersionNo = c.String(),
                        VersionDescr = c.String(),
                        UseFlag = c.Boolean(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.VersionId);
            
            CreateTable(
                "dbo.AcmMasAccounts",
                c => new
                    {
                        GlAccId = c.Long(nullable: false, identity: true),
                        GlAccId2 = c.String(),
                        GlAccName = c.String(),
                        GlUpperAccId = c.Int(),
                        RecordStatus = c.String(),
                    })
                .PrimaryKey(t => t.GlAccId);
            
            CreateTable(
                "dbo.AcmMasBaseAccount",
                c => new
                    {
                        CashAccountId = c.Int(nullable: false, identity: true),
                        DnCrAccount = c.Int(),
                        LoadAccountId = c.Int(),
                        TaxAccountId = c.Int(),
                        RemainAccountId = c.Int(),
                        PenaltyAccountId = c.Int(),
                        OverAccountId = c.Int(),
                        DirectPayAccountId = c.Int(),
                        IncomeBbAccountId = c.Int(),
                        WaitIncomeBbAccountId = c.Int(),
                        RedemptionAccountId = c.Int(),
                        CollateralAccountId1 = c.Int(),
                        CollateralAccountId2 = c.Int(),
                        CollateralAccountId3 = c.Int(),
                        CollateralAccountId4 = c.Int(),
                        PayIncomeAccountId = c.Int(),
                        GovIncomeAccountId = c.Int(),
                        GovDepositAccountId = c.Int(),
                        WaitAccountId = c.Int(),
                        UpdatedBy = c.Int(),
                        CreatedBy = c.DateTime(),
                    })
                .PrimaryKey(t => t.CashAccountId);
            
            CreateTable(
                "dbo.AcmMasFiscalPeriod",
                c => new
                    {
                        FiscalPeriod = c.Int(nullable: false, identity: true),
                        FiscalPeriodCode = c.String(),
                        FiscalPeriodName = c.String(),
                        FiscalPeriodRemark = c.String(),
                        FiscalStartDate = c.DateTime(),
                        FiscalEndDate = c.DateTime(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FiscalPeriod);
            
            CreateTable(
                "dbo.AcmTransection",
                c => new
                    {
                        TranId = c.Int(nullable: false, identity: true),
                        TranType = c.String(),
                        FiscalPeriod = c.String(),
                        TransferId = c.Int(),
                        TranCode = c.String(),
                        TranDate = c.DateTime(),
                        BgYear = c.Int(),
                        WorkAreaId = c.Int(),
                        BgSourceId = c.Int(),
                        RefNo = c.String(),
                        TranName = c.String(),
                        Remarks = c.String(),
                        ApprovedBy = c.Int(),
                        ApprovedWhen = c.DateTime(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TranId)
                .ForeignKey("dbo.FimTransfer", t => t.TransferId)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.WorkAreaId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId)
                .Index(t => t.TransferId)
                .Index(t => t.WorkAreaId)
                .Index(t => t.BgSourceId);
            
            CreateTable(
                "dbo.FimTransfer",
                c => new
                    {
                        TransferId = c.Int(nullable: false, identity: true),
                        BgSourceId = c.Int(nullable: false),
                        WorkAreaId = c.Int(nullable: false),
                        BgYear = c.Int(nullable: false),
                        TransferType = c.String(),
                        TransferName = c.String(),
                        RefNo = c.String(),
                        TransferDate = c.DateTime(),
                        FromBankAccId = c.Int(),
                        ToBankAccId = c.Int(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        EmpId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TransferId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.WorkAreaId, cascadeDelete: true)
                .ForeignKey("dbo.FimMasBankAccount", t => t.FromBankAccId)
                .ForeignKey("dbo.FimMasBankAccount", t => t.ToBankAccId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.BgSourceId)
                .Index(t => t.WorkAreaId)
                .Index(t => t.FromBankAccId)
                .Index(t => t.ToBankAccId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.bgm_mas_source",
                c => new
                    {
                        bgm_source_seq = c.Int(nullable: false, identity: true),
                        bgm_source_code = c.String(storeType: "ntext"),
                        gfmis_code = c.String(storeType: "ntext"),
                        bgm_source_name = c.String(storeType: "ntext"),
                        bgm_source_descr = c.String(storeType: "ntext"),
                        upper_bgm_source_seq = c.Int(),
                        bgm_source_type_seq = c.Int(),
                        bgm_year_type_seq = c.Int(),
                        use_petition = c.Boolean(nullable: false),
                        use_request = c.Boolean(nullable: false),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_source_seq)
                .ForeignKey("dbo.bgm_mas_source", t => t.upper_bgm_source_seq)
                .ForeignKey("dbo.bgm_mas_source_type", t => t.bgm_source_type_seq)
                .ForeignKey("dbo.sys_year_type", t => t.bgm_year_type_seq)
                .Index(t => t.upper_bgm_source_seq)
                .Index(t => t.bgm_source_type_seq)
                .Index(t => t.bgm_year_type_seq);
            
            CreateTable(
                "dbo.bgm_mas_source_type",
                c => new
                    {
                        bgm_source_type_seq = c.Int(nullable: false, identity: true),
                        bgm_source_type_code = c.String(storeType: "ntext"),
                        bgm_source_type_name = c.String(storeType: "ntext"),
                        bgm_source_type_descr = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_source_type_seq);
            
            CreateTable(
                "dbo.sys_year_type",
                c => new
                    {
                        year_type_seq = c.Int(nullable: false, identity: true),
                        year_type_name = c.String(),
                        year_type_descr = c.String(),
                        month_start = c.Int(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.year_type_seq);
            
            CreateTable(
                "dbo.HrmMasWorkArea",
                c => new
                    {
                        WorkAreaId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        ScopeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.WorkAreaId)
                .ForeignKey("dbo.HrmMasScope", t => t.ScopeId)
                .Index(t => t.ScopeId);
            
            CreateTable(
                "dbo.HrmMasScope",
                c => new
                    {
                        ScopeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        MasScope_ScopeId = c.Int(),
                    })
                .PrimaryKey(t => t.ScopeId)
                .ForeignKey("dbo.HrmMasScope", t => t.MasScope_ScopeId)
                .Index(t => t.MasScope_ScopeId);
            
            CreateTable(
                "dbo.FimMasBankAccount",
                c => new
                    {
                        BankAccId = c.Int(nullable: false, identity: true),
                        BankAccNo = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        BankAccTypeId = c.Int(),
                        BranchId = c.Int(),
                        BgmSourceId = c.Int(),
                        SavingBankAccId = c.Int(),
                        AccountId = c.Int(),
                        WorkAreaId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BankAccId)
                .ForeignKey("dbo.FimMasBankBranch", t => t.BranchId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgmSourceId)
                .ForeignKey("dbo.FimMasBankAccount", t => t.SavingBankAccId)
                .ForeignKey("dbo.FimMasLookUp", t => t.BankAccTypeId)
                .ForeignKey("dbo.AcmMasAccount", t => t.AccountId)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.WorkAreaId)
                .Index(t => t.BranchId)
                .Index(t => t.BgmSourceId)
                .Index(t => t.SavingBankAccId)
                .Index(t => t.BankAccTypeId)
                .Index(t => t.AccountId)
                .Index(t => t.WorkAreaId);
            
            CreateTable(
                "dbo.FimMasBankBranch",
                c => new
                    {
                        BranchId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        BranchName = c.String(),
                        BranchNameEng = c.String(),
                        BankId = c.Int(nullable: false),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BranchId)
                .ForeignKey("dbo.FimMasBank", t => t.BankId, cascadeDelete: true)
                .Index(t => t.BankId);
            
            CreateTable(
                "dbo.FimMasBank",
                c => new
                    {
                        BankId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BankId);
            
            CreateTable(
                "dbo.FimMasLookUp",
                c => new
                    {
                        LookUpId = c.Int(nullable: false, identity: true),
                        LookUpTypeId = c.Int(nullable: false),
                        Name = c.String(),
                        Descr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(nullable: false),
                        CreatedWhen = c.DateTime(nullable: false),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.LookUpId)
                .ForeignKey("dbo.FimMasLookUpType", t => t.LookUpTypeId, cascadeDelete: true)
                .Index(t => t.LookUpTypeId);
            
            CreateTable(
                "dbo.FimMasLookUpType",
                c => new
                    {
                        LookUpTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Descr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(nullable: false),
                        CreatedWhen = c.DateTime(nullable: false),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.LookUpTypeId);
            
            CreateTable(
                "dbo.hrm_ps_employees",
                c => new
                    {
                        emp_seq = c.Int(nullable: false, identity: true),
                        gender_seq = c.Int(nullable: false),
                        name_prefix_seq = c.Int(nullable: false),
                        first_name = c.String(nullable: false),
                        last_name = c.String(nullable: false),
                        first_name_eng = c.String(),
                        last_name_eng = c.String(),
                        nick_name = c.String(),
                        religion_seq = c.Int(),
                        race_national_seq = c.Int(),
                        national_seq = c.Int(),
                        birth_date = c.DateTime(nullable: false),
                        blood_group = c.String(),
                        citizen = c.String(nullable: false, maxLength: 13),
                        tax_payer = c.String(maxLength: 13),
                        social = c.String(maxLength: 13),
                        official = c.String(maxLength: 13),
                        EmpTypeId = c.Int(),
                        class_seq = c.Int(),
                        salary_level_seq = c.Int(),
                        salary = c.Decimal(precision: 18, scale: 2),
                        pos_seq = c.Int(),
                        exec_pos_seq = c.Int(),
                        working_job_site_seq = c.Int(),
                        admitted_date = c.DateTime(),
                        work_start_date = c.DateTime(),
                        quit_date = c.DateTime(),
                        probation_end_date = c.DateTime(),
                        death_date = c.DateTime(),
                        latest_position_date = c.DateTime(),
                        latest_class_date = c.DateTime(),
                        latest_working_job_site_date = c.DateTime(),
                        marital_status_seq = c.Int(),
                        image_unique = c.String(),
                        emp_status_seq = c.Int(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.emp_seq)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.name_prefix_seq, cascadeDelete: true)
                .ForeignKey("dbo.hrm_mas_gender", t => t.gender_seq, cascadeDelete: true)
                .ForeignKey("dbo.hrm_mas_religion", t => t.religion_seq)
                .ForeignKey("dbo.hrm_mas_nationality", t => t.race_national_seq)
                .ForeignKey("dbo.hrm_mas_nationality", t => t.national_seq)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.hrm_mas_class", t => t.class_seq)
                .ForeignKey("dbo.hrm_position", t => t.pos_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.working_job_site_seq)
                .ForeignKey("dbo.hrm_mas_employee_status", t => t.emp_status_seq)
                .ForeignKey("dbo.hrm_executive_position", t => t.exec_pos_seq)
                .ForeignKey("dbo.hrm_mas_marital_status", t => t.marital_status_seq)
                .Index(t => t.name_prefix_seq)
                .Index(t => t.gender_seq)
                .Index(t => t.religion_seq)
                .Index(t => t.race_national_seq)
                .Index(t => t.national_seq)
                .Index(t => t.EmpTypeId)
                .Index(t => t.class_seq)
                .Index(t => t.pos_seq)
                .Index(t => t.working_job_site_seq)
                .Index(t => t.emp_status_seq)
                .Index(t => t.exec_pos_seq)
                .Index(t => t.marital_status_seq);
            
            CreateTable(
                "dbo.HrmMasNamePrefix",
                c => new
                    {
                        NamePrefixId = c.Int(nullable: false, identity: true),
                        GenderId = c.Int(),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        NameShort = c.String(),
                        NameEngShort = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.NamePrefixId)
                .ForeignKey("dbo.hrm_mas_gender", t => t.GenderId)
                .Index(t => t.GenderId);
            
            CreateTable(
                "dbo.hrm_mas_gender",
                c => new
                    {
                        gender_seq = c.Int(nullable: false, identity: true),
                        gender_name = c.String(),
                        name_eng = c.String(),
                        thai = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.gender_seq);
            
            CreateTable(
                "dbo.hrm_mas_religion",
                c => new
                    {
                        religion_seq = c.Int(nullable: false, identity: true),
                        religion_code = c.String(),
                        religion_name = c.String(),
                        name_eng = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.religion_seq);
            
            CreateTable(
                "dbo.hrm_mas_nationality",
                c => new
                    {
                        nat_seq = c.Int(nullable: false, identity: true),
                        nat_name = c.Int(nullable: false),
                        nat_name_eng = c.Int(nullable: false),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.nat_seq);
            
            CreateTable(
                "dbo.hrm_mas_employee_type",
                c => new
                    {
                        emp_type_seq = c.Int(nullable: false, identity: true),
                        emp_type_name = c.String(),
                        salary_up_time = c.Int(),
                        age_retirement = c.Int(),
                        year_type_seq = c.Int(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.emp_type_seq)
                .ForeignKey("dbo.sys_year_type", t => t.year_type_seq)
                .Index(t => t.year_type_seq);
            
            CreateTable(
                "dbo.hrm_mas_class",
                c => new
                    {
                        class_seq = c.Int(nullable: false, identity: true),
                        class_no = c.String(),
                        class_name = c.String(),
                        name_short = c.String(),
                        name_eng = c.String(),
                        name_eng_short = c.String(),
                        pos_type_seq = c.Int(nullable: false),
                        emp_type_seq = c.Int(nullable: false),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.class_seq)
                .ForeignKey("dbo.HrmMasPositionType", t => t.pos_type_seq, cascadeDelete: true)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.emp_type_seq, cascadeDelete: true)
                .Index(t => t.pos_type_seq)
                .Index(t => t.emp_type_seq);
            
            CreateTable(
                "dbo.HrmMasPositionType",
                c => new
                    {
                        PosTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        NameShort = c.String(),
                        NameEng = c.String(),
                        NameEngShort = c.String(),
                        EmpTypeId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PosTypeId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.hrm_position",
                c => new
                    {
                        pos_seq = c.Int(nullable: false, identity: true),
                        pos_no = c.Int(),
                        pos_name = c.String(),
                        upper_pos_seq = c.Int(),
                        working_upper_pos_seq = c.Int(),
                        job_site_seq = c.Int(),
                        field_pos_seq = c.Int(),
                        exec_pos_seq = c.Int(),
                        emp_type_seq = c.Int(),
                        defined_date = c.DateTime(),
                        money_support_date = c.DateTime(),
                        salary_quota = c.Decimal(precision: 18, scale: 2),
                        salary_min = c.Decimal(precision: 18, scale: 2),
                        salary_max = c.Decimal(precision: 18, scale: 2),
                        pos_exec_salary = c.Decimal(precision: 18, scale: 2),
                        job_description = c.String(),
                        pos_status_seq = c.Int(nullable: false),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                        Position_PosId = c.Int(),
                        Position_PosId1 = c.Int(),
                    })
                .PrimaryKey(t => t.pos_seq)
                .ForeignKey("dbo.hrm_position", t => t.upper_pos_seq)
                .ForeignKey("dbo.hrm_position", t => t.working_upper_pos_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.job_site_seq)
                .ForeignKey("dbo.HrmFieldPosition", t => t.field_pos_seq)
                .ForeignKey("dbo.hrm_executive_position", t => t.exec_pos_seq)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.emp_type_seq)
                .ForeignKey("dbo.HrmMasPositionStatus", t => t.pos_status_seq, cascadeDelete: true)
                .ForeignKey("dbo.hrm_position", t => t.Position_PosId)
                .ForeignKey("dbo.hrm_position", t => t.Position_PosId1)
                .Index(t => t.upper_pos_seq)
                .Index(t => t.working_upper_pos_seq)
                .Index(t => t.job_site_seq)
                .Index(t => t.field_pos_seq)
                .Index(t => t.exec_pos_seq)
                .Index(t => t.emp_type_seq)
                .Index(t => t.pos_status_seq)
                .Index(t => t.Position_PosId)
                .Index(t => t.Position_PosId1);
            
            CreateTable(
                "dbo.hrm_job_site",
                c => new
                    {
                        job_site_seq = c.Int(nullable: false, identity: true),
                        job_site_code = c.String(),
                        job_site_name = c.String(),
                        name_short = c.String(),
                        name_eng = c.String(),
                        name_eng_short = c.String(),
                        gfmis_code = c.String(),
                        upper_job_site_seq = c.Int(),
                        full_path = c.String(),
                        ref_job_site_seq = c.Int(),
                        job_site_type_seq = c.Int(),
                        work_area_seq = c.Int(),
                        job_site_level_seq = c.Int(),
                        header_pos_seq = c.Int(),
                        address = c.String(),
                        district_seq = c.Int(),
                        provnce_seq = c.Int(),
                        city_seq = c.Int(),
                        country_seq = c.Int(),
                        postal_code = c.String(),
                        tel = c.String(),
                        fax = c.String(),
                        web_address = c.String(),
                        job_site_status_seq = c.Int(),
                        job_description = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                        JobSite_JobSiteId = c.Int(),
                    })
                .PrimaryKey(t => t.job_site_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.upper_job_site_seq)
                .ForeignKey("dbo.HrmMasJobSiteType", t => t.job_site_type_seq)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.work_area_seq)
                .ForeignKey("dbo.HrmMasJobSiteLevel", t => t.job_site_level_seq)
                .ForeignKey("dbo.HrmMasDistrict", t => t.district_seq)
                .ForeignKey("dbo.HrmMasProvince", t => t.provnce_seq)
                .ForeignKey("dbo.HrmMasCity", t => t.city_seq)
                .ForeignKey("dbo.HrmMasCountry", t => t.country_seq)
                .ForeignKey("dbo.HrmMasJobSiteStatus", t => t.job_site_status_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSite_JobSiteId)
                .Index(t => t.upper_job_site_seq)
                .Index(t => t.job_site_type_seq)
                .Index(t => t.work_area_seq)
                .Index(t => t.job_site_level_seq)
                .Index(t => t.district_seq)
                .Index(t => t.provnce_seq)
                .Index(t => t.city_seq)
                .Index(t => t.country_seq)
                .Index(t => t.job_site_status_seq)
                .Index(t => t.JobSite_JobSiteId);
            
            CreateTable(
                "dbo.HrmMasJobSiteType",
                c => new
                    {
                        JobSiteTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        CurrentJobSiteId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.JobSiteTypeId)
                .ForeignKey("dbo.hrm_job_site", t => t.CurrentJobSiteId)
                .Index(t => t.CurrentJobSiteId);
            
            CreateTable(
                "dbo.HrmMasJobSiteLevel",
                c => new
                    {
                        JobSiteLevelId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.JobSiteLevelId);
            
            CreateTable(
                "dbo.HrmMasDistrict",
                c => new
                    {
                        DistrictId = c.Int(nullable: false, identity: true),
                        AmphurId = c.Int(),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DistrictId)
                .ForeignKey("dbo.HrmMasAmphur", t => t.AmphurId)
                .Index(t => t.AmphurId);
            
            CreateTable(
                "dbo.HrmMasAmphur",
                c => new
                    {
                        AmphurId = c.Int(nullable: false, identity: true),
                        ProvinceId = c.Int(),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AmphurId)
                .ForeignKey("dbo.HrmMasProvince", t => t.ProvinceId)
                .Index(t => t.ProvinceId);
            
            CreateTable(
                "dbo.HrmMasProvince",
                c => new
                    {
                        ProvinceId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ProvinceId);
            
            CreateTable(
                "dbo.HrmMasCity",
                c => new
                    {
                        CityId = c.Int(nullable: false, identity: true),
                        CountryId = c.Int(),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CityId)
                .ForeignKey("dbo.HrmMasCountry", t => t.CountryId)
                .Index(t => t.CountryId);
            
            CreateTable(
                "dbo.HrmMasCountry",
                c => new
                    {
                        CountryId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CountryId);
            
            CreateTable(
                "dbo.HrmMasJobSiteStatus",
                c => new
                    {
                        JobSiteStatusId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.JobSiteStatusId);
            
            CreateTable(
                "dbo.HrmFieldPosition",
                c => new
                    {
                        FieldPosId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        NameEng = c.String(),
                        EmpTypeId = c.Int(),
                        PosTypeId = c.Int(),
                        FieldGroupId = c.Int(),
                        ClassSpecId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldPosId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.PosTypeId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.PosTypeId);
            
            CreateTable(
                "dbo.hrm_executive_position",
                c => new
                    {
                        exec_pos_seq = c.Int(nullable: false, identity: true),
                        exec_pos_code = c.String(),
                        exec_pos_name = c.String(),
                        name_eng = c.String(),
                        name_short = c.String(),
                        name_eng_short = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.exec_pos_seq);
            
            CreateTable(
                "dbo.HrmMasPositionStatus",
                c => new
                    {
                        PosStatusId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PosStatusId);
            
            CreateTable(
                "dbo.hrm_mas_employee_status",
                c => new
                    {
                        emp_status_seq = c.Int(nullable: false, identity: true),
                        emp_status_code = c.String(),
                        emp_status_name = c.String(),
                        active = c.Boolean(nullable: false),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.emp_status_seq);
            
            CreateTable(
                "dbo.hrm_mas_marital_status",
                c => new
                    {
                        mar_status_seq = c.Int(nullable: false, identity: true),
                        mar_status_name = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.mar_status_seq);
            
            CreateTable(
                "dbo.AcmTransectionDtl",
                c => new
                    {
                        TranDtlsId = c.Int(nullable: false, identity: true),
                        TranId = c.Int(),
                        AccountId = c.Int(),
                        DrOrCr = c.String(),
                        Amount = c.Double(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TranDtlsId)
                .ForeignKey("dbo.AcmTransection", t => t.TranId)
                .ForeignKey("dbo.AcmMasAccount", t => t.AccountId)
                .Index(t => t.TranId)
                .Index(t => t.AccountId);
            
            CreateTable(
                "dbo.AcmTransectionGroup",
                c => new
                    {
                        TranGrpId = c.Int(nullable: false, identity: true),
                        TranGrpCode = c.String(),
                        RefType = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TranGrpId);
            
            CreateTable(
                "dbo.bgm_mas_expense",
                c => new
                    {
                        bgm_exp_seq = c.Int(nullable: false, identity: true),
                        bgm_exp_code = c.String(storeType: "ntext"),
                        bgm_exp_name = c.String(storeType: "ntext"),
                        bgm_exp_descr = c.String(storeType: "ntext"),
                        upper_bgm_exp_seq = c.Int(),
                        bgm_exp_grp_seq = c.Int(),
                        bgm_exp_grp_id_real = c.Int(),
                        account_seq = c.Int(),
                        icm_resource_seq = c.Int(),
                        icm_resource_type = c.String(storeType: "ntext"),
                        gfmis_code = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_exp_seq)
                .ForeignKey("dbo.bgm_mas_expense", t => t.upper_bgm_exp_seq)
                .ForeignKey("dbo.bgm_mas_expense_group", t => t.bgm_exp_grp_seq)
                .ForeignKey("dbo.bgm_mas_expense_group", t => t.bgm_exp_grp_id_real)
                .ForeignKey("dbo.AcmMasAccount", t => t.account_seq)
                .Index(t => t.upper_bgm_exp_seq)
                .Index(t => t.bgm_exp_grp_seq)
                .Index(t => t.bgm_exp_grp_id_real)
                .Index(t => t.account_seq);
            
            CreateTable(
                "dbo.bgm_mas_expense_group",
                c => new
                    {
                        bgm_exp_grp_seq = c.Int(nullable: false, identity: true),
                        bgm_exp_grp_code = c.String(storeType: "ntext"),
                        bgm_exp_grp_name = c.String(storeType: "ntext"),
                        bgm_exp_grp_descr = c.String(storeType: "ntext"),
                        bgm_exp_grp_x = c.Int(),
                        bgm_source_seq = c.Int(),
                        gfmis_code = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_exp_grp_seq);
            
            CreateTable(
                "dbo.bgm_mas_expense_source",
                c => new
                    {
                        bgm_exp_source_seq = c.Int(nullable: false, identity: true),
                        bgm_exp_seq = c.Int(),
                        bgm_source_seq = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_exp_source_seq)
                .ForeignKey("dbo.bgm_mas_expense", t => t.bgm_exp_seq)
                .ForeignKey("dbo.bgm_mas_source", t => t.bgm_source_seq)
                .Index(t => t.bgm_exp_seq)
                .Index(t => t.bgm_source_seq);
            
            CreateTable(
                "dbo.bgm_project",
                c => new
                    {
                        bgm_proj_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_code = c.String(storeType: "ntext"),
                        bgm_proj_name = c.String(storeType: "ntext"),
                        bgm_proj_descr = c.String(storeType: "ntext"),
                        bgm_proj_manager = c.Int(),
                        bgm_proj_scope = c.Int(),
                        bgm_proj_date = c.DateTime(storeType: "datetime2"),
                        bgm_proj_reason = c.String(storeType: "ntext"),
                        bgm_proj_object = c.String(storeType: "ntext"),
                        bgm_proj_target = c.String(storeType: "ntext"),
                        bgm_proj_plan = c.String(storeType: "ntext"),
                        bgm_proj_remark = c.String(storeType: "ntext"),
                        bgm_strat_list_seq = c.Int(),
                        prj_type_seq = c.Int(),
                        job_site_seq = c.Int(),
                        job_site_seq_main = c.Int(),
                        bgm_year = c.Int(),
                        date_start = c.DateTime(storeType: "datetime2"),
                        date_end = c.DateTime(storeType: "datetime2"),
                        gfmis_code = c.String(storeType: "ntext"),
                        alt_proj_seq = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_seq);
            
            CreateTable(
                "dbo.bgm_project_expense",
                c => new
                    {
                        bgm_proj_exp_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_seq = c.Int(),
                        descr = c.String(storeType: "ntext"),
                        total_amount = c.Decimal(precision: 18, scale: 2),
                        total_amount_out_plan = c.Decimal(precision: 18, scale: 2),
                        remark = c.String(storeType: "ntext"),
                        mtef1 = c.Decimal(precision: 18, scale: 2),
                        mtef2 = c.Decimal(precision: 18, scale: 2),
                        mtef3 = c.Decimal(precision: 18, scale: 2),
                        bgm_source_seq = c.Int(),
                        bgm_exp_seq = c.Int(),
                        icm_res_item_seq = c.Int(),
                        unit_price = c.Decimal(precision: 18, scale: 2),
                        unit_qty = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_exp_seq)
                .ForeignKey("dbo.bgm_project", t => t.bgm_proj_seq)
                .ForeignKey("dbo.bgm_mas_source", t => t.bgm_source_seq)
                .ForeignKey("dbo.bgm_mas_expense", t => t.bgm_exp_seq)
                .ForeignKey("dbo.IcmMasResourceItem", t => t.icm_res_item_seq)
                .Index(t => t.bgm_proj_seq)
                .Index(t => t.bgm_source_seq)
                .Index(t => t.bgm_exp_seq)
                .Index(t => t.icm_res_item_seq);
            
            CreateTable(
                "dbo.IcmMasResourceItem",
                c => new
                    {
                        ResItemId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        OldCode = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        ResSubGrpId = c.Int(),
                        GpscCode = c.String(),
                        GiinCode = c.String(),
                        StdPrice = c.Double(),
                        MinPrice = c.Double(),
                        MaxPrice = c.Double(),
                        UnitId = c.Int(),
                        MinQty = c.Int(),
                        MaxQty = c.Int(),
                        ImageName = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ResItemId)
                .ForeignKey("dbo.IcmMasResourceSubGroup", t => t.ResSubGrpId)
                .ForeignKey("dbo.IcmMasUnit", t => t.UnitId)
                .Index(t => t.ResSubGrpId)
                .Index(t => t.UnitId);
            
            CreateTable(
                "dbo.IcmMasResourceSubGroup",
                c => new
                    {
                        ResSubGrpId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        OldCode = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        ResGrpId = c.Int(),
                        UnspscCode = c.String(),
                        IncCode = c.String(),
                        DpTypeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ResSubGrpId)
                .ForeignKey("dbo.IcmMasResourceGroup", t => t.ResGrpId)
                .ForeignKey("dbo.IcmMasDepreciationType", t => t.DpTypeId)
                .Index(t => t.ResGrpId)
                .Index(t => t.DpTypeId);
            
            CreateTable(
                "dbo.IcmMasResourceGroup",
                c => new
                    {
                        ResGrpId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        OldCode = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        ResTypeId = c.Int(),
                        MinPriceCalDepreciation = c.Double(),
                        DpTypeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        AssetAccountId = c.Int(),
                        CumdepreAccountId = c.Int(),
                        DepreAccountId = c.Int(),
                        BreakAccountId = c.Int(),
                        ConsumeAccountId = c.Int(),
                    })
                .PrimaryKey(t => t.ResGrpId)
                .ForeignKey("dbo.IcmMasResourceType", t => t.ResTypeId)
                .ForeignKey("dbo.IcmMasDepreciationType", t => t.DpTypeId)
                .ForeignKey("dbo.AcmMasAccount", t => t.AssetAccountId)
                .ForeignKey("dbo.AcmMasAccount", t => t.DepreAccountId)
                .ForeignKey("dbo.AcmMasAccount", t => t.BreakAccountId)
                .ForeignKey("dbo.AcmMasAccount", t => t.ConsumeAccountId)
                .ForeignKey("dbo.AcmMasAccount", t => t.CumdepreAccountId)
                .Index(t => t.ResTypeId)
                .Index(t => t.DpTypeId)
                .Index(t => t.AssetAccountId)
                .Index(t => t.DepreAccountId)
                .Index(t => t.BreakAccountId)
                .Index(t => t.ConsumeAccountId)
                .Index(t => t.CumdepreAccountId);
            
            CreateTable(
                "dbo.IcmMasResourceType",
                c => new
                    {
                        ResTypeId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        DepreciationCalculate = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ResTypeId);
            
            CreateTable(
                "dbo.IcmMasDepreciationType",
                c => new
                    {
                        DpTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        ScrapValue = c.Decimal(nullable: false, precision: 18, scale: 2),
                        DpRateYear = c.Decimal(nullable: false, precision: 18, scale: 2),
                        MinRateYear = c.Decimal(nullable: false, precision: 18, scale: 2),
                        MaxRateYear = c.Decimal(nullable: false, precision: 18, scale: 2),
                        MinLifeYear = c.Int(nullable: false),
                        MaxLifeYear = c.Int(nullable: false),
                        RecordStatus = c.String(maxLength: 2),
                        CreatedBy = c.Int(nullable: false),
                        CreatedWhen = c.DateTime(nullable: false),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DpTypeId);
            
            CreateTable(
                "dbo.IcmMasUnit",
                c => new
                    {
                        UnitId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(nullable: false),
                        Sign = c.String(),
                        Descr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.UnitId);
            
            CreateTable(
                "dbo.bgm_project_activity_plan",
                c => new
                    {
                        bgm_proj_act_plan_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_seq = c.Int(),
                        descr = c.String(storeType: "ntext"),
                        act_month1 = c.Int(),
                        act_month2 = c.Int(),
                        act_month3 = c.Int(),
                        act_month4 = c.Int(),
                        act_month5 = c.Int(),
                        act_month6 = c.Int(),
                        act_month7 = c.Int(),
                        act_month8 = c.Int(),
                        act_month9 = c.Int(),
                        act_month10 = c.Int(),
                        act_month11 = c.Int(),
                        act_month12 = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_act_plan_seq)
                .ForeignKey("dbo.bgm_project", t => t.bgm_proj_seq)
                .Index(t => t.bgm_proj_seq);
            
            CreateTable(
                "dbo.bgm_project_manager",
                c => new
                    {
                        bgm_proj_mng_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_seq = c.Int(),
                        emp_seq = c.Int(),
                    })
                .PrimaryKey(t => t.bgm_proj_mng_seq)
                .ForeignKey("dbo.bgm_project", t => t.bgm_proj_seq)
                .ForeignKey("dbo.hrm_ps_employees", t => t.emp_seq)
                .Index(t => t.bgm_proj_seq)
                .Index(t => t.emp_seq);
            
            CreateTable(
                "dbo.bgm_project_option",
                c => new
                    {
                        bgm_proj_opt_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_seq = c.Int(),
                        descr = c.String(storeType: "ntext"),
                        weight = c.Decimal(precision: 18, scale: 2),
                        bgm_option_seq = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_opt_seq)
                .ForeignKey("dbo.bgm_mas_option", t => t.bgm_option_seq)
                .ForeignKey("dbo.bgm_project", t => t.bgm_proj_seq)
                .Index(t => t.bgm_option_seq)
                .Index(t => t.bgm_proj_seq);
            
            CreateTable(
                "dbo.bgm_mas_option",
                c => new
                    {
                        bgm_option_seq = c.Int(nullable: false, identity: true),
                        bgm_option_code = c.String(storeType: "ntext"),
                        bgm_option_name = c.String(storeType: "ntext"),
                        bgm_option_descr = c.String(storeType: "ntext"),
                        upper_bgm_option_seq = c.Int(),
                        job_site_seq = c.Int(),
                        bgm_option_type_seq = c.Int(),
                        bgm_year = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_option_seq)
                .ForeignKey("dbo.bgm_mas_option", t => t.upper_bgm_option_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.job_site_seq)
                .ForeignKey("dbo.bgm_system_option_type", t => t.bgm_option_type_seq)
                .Index(t => t.upper_bgm_option_seq)
                .Index(t => t.job_site_seq)
                .Index(t => t.bgm_option_type_seq);
            
            CreateTable(
                "dbo.bgm_system_option_type",
                c => new
                    {
                        bgm_option_type_seq = c.Int(nullable: false, identity: true),
                        bgm_option_type_name = c.String(storeType: "ntext"),
                        has_child = c.Int(),
                        label_name = c.String(storeType: "ntext"),
                        has_jobsite = c.Int(),
                        has_description = c.Int(),
                        label_header = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                    })
                .PrimaryKey(t => t.bgm_option_type_seq);
            
            CreateTable(
                "dbo.bgm_project_report",
                c => new
                    {
                        bgm_proj_rpt_seq = c.Int(nullable: false, identity: true),
                        descr = c.String(storeType: "ntext"),
                        bgm_proj_exp_seq = c.Int(),
                        bgm_proj_oper_exp_seq = c.Int(),
                        used_amount = c.Decimal(precision: 18, scale: 2),
                        cal_amount = c.Decimal(precision: 18, scale: 2),
                        rpt_type = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_rpt_seq)
                .ForeignKey("dbo.bgm_project_expense", t => t.bgm_proj_exp_seq)
                .ForeignKey("dbo.bgm_project_operation_expense", t => t.bgm_proj_oper_exp_seq)
                .Index(t => t.bgm_proj_exp_seq)
                .Index(t => t.bgm_proj_oper_exp_seq);
            
            CreateTable(
                "dbo.bgm_project_operation_expense",
                c => new
                    {
                        bgm_proj_oper_exp_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_oper_seq = c.Int(),
                        bgm_proj_oper_descr = c.String(storeType: "ntext"),
                        bgm_proj_exp_seq = c.Int(),
                        amount = c.Decimal(precision: 18, scale: 2),
                        unit_price = c.Decimal(precision: 18, scale: 2),
                        unit_qty = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_oper_exp_seq)
                .ForeignKey("dbo.bgm_project_operation", t => t.bgm_proj_oper_seq)
                .ForeignKey("dbo.bgm_project_expense", t => t.bgm_proj_exp_seq)
                .Index(t => t.bgm_proj_oper_seq)
                .Index(t => t.bgm_proj_exp_seq);
            
            CreateTable(
                "dbo.bgm_project_operation",
                c => new
                    {
                        bgm_proj_oper_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_oper_code = c.String(storeType: "ntext"),
                        bgm_proj_oper_name = c.String(storeType: "ntext"),
                        bgm_proj_oper_descr = c.String(storeType: "ntext"),
                        bgm_proj_oper_date = c.DateTime(storeType: "datetime2"),
                        start_date = c.DateTime(storeType: "datetime2"),
                        end_date = c.DateTime(storeType: "datetime2"),
                        attend_count = c.Int(),
                        bgm_proj_seq = c.Int(),
                        emp_seq = c.Int(),
                        job_site_seq = c.Int(),
                        is_use = c.String(storeType: "ntext"),
                        work_place = c.String(storeType: "ntext"),
                        bgm_year = c.Int(),
                        scope = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_oper_seq)
                .ForeignKey("dbo.bgm_project", t => t.bgm_proj_seq)
                .ForeignKey("dbo.hrm_ps_employees", t => t.emp_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.job_site_seq)
                .Index(t => t.bgm_proj_seq)
                .Index(t => t.emp_seq)
                .Index(t => t.job_site_seq);
            
            CreateTable(
                "dbo.bgm_project_operation_person",
                c => new
                    {
                        bgm_proj_oper_per_seq = c.Int(nullable: false, identity: true),
                        bgm_proj_oper_seq = c.Int(),
                        emp_seq = c.Int(),
                        ContactId = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_oper_per_seq)
                .ForeignKey("dbo.bgm_project_operation", t => t.bgm_proj_oper_seq)
                .ForeignKey("dbo.hrm_ps_employees", t => t.emp_seq)
                .ForeignKey("dbo.IcmMasContact", t => t.ContactId)
                .Index(t => t.bgm_proj_oper_seq)
                .Index(t => t.emp_seq)
                .Index(t => t.ContactId);
            
            CreateTable(
                "dbo.IcmMasContact",
                c => new
                    {
                        ConId = c.Int(nullable: false, identity: true),
                        NameTh = c.String(nullable: false),
                        NameEng = c.String(),
                        ConCategory = c.Int(nullable: false),
                        ConGrpId = c.Int(nullable: false),
                        TaxCode = c.String(),
                        RegistedDate = c.DateTime(),
                        RegistedCapital = c.Decimal(precision: 18, scale: 2),
                        GfmisCode = c.String(),
                        Coordinator = c.String(),
                        VatTypeId = c.Int(),
                        ConStatusId = c.Int(),
                        StatRemarks = c.String(),
                        Country = c.String(),
                        Building = c.String(),
                        Floor = c.String(),
                        Village = c.String(),
                        Address = c.String(),
                        Road = c.String(),
                        Lane = c.String(),
                        District = c.String(),
                        Amphur = c.String(),
                        Postal = c.String(),
                        Province = c.String(),
                        Tel = c.String(),
                        TelNext = c.String(),
                        Fax = c.String(),
                        FaxNext = c.String(),
                        Email = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ConId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ConGrpId, cascadeDelete: true)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ConStatusId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.VatTypeId)
                .Index(t => t.ConGrpId)
                .Index(t => t.ConStatusId)
                .Index(t => t.VatTypeId);
            
            CreateTable(
                "dbo.IcmMasLookUp",
                c => new
                    {
                        LookUpId = c.Int(nullable: false, identity: true),
                        LookUpTypeId = c.Int(nullable: false),
                        LookUpName = c.String(),
                        Description = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(nullable: false),
                        CreatedWhen = c.DateTime(nullable: false),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.LookUpId)
                .ForeignKey("dbo.IcmMasLookUpType", t => t.LookUpTypeId, cascadeDelete: true)
                .Index(t => t.LookUpTypeId);
            
            CreateTable(
                "dbo.IcmMasLookUpType",
                c => new
                    {
                        LookUpTypeId = c.Int(nullable: false, identity: true),
                        LookUpTypeName = c.String(),
                        Description = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(nullable: false),
                        CreatedWhen = c.DateTime(nullable: false),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.LookUpTypeId);
            
            CreateTable(
                "dbo.bgm_project_operation_report",
                c => new
                    {
                        bgm_proj_oper_rpt_seq = c.Int(nullable: false, identity: true),
                        descr = c.String(storeType: "ntext"),
                        bgm_proj_oper_exp_seq = c.Int(),
                        icm_ppr_item_seq = c.Int(),
                        icm_pr_item_seq = c.Int(),
                        icm_po_install_item_seq = c.Int(),
                        icm_dn_item_seq = c.Int(),
                        money_req_dtls_seq = c.Int(),
                        return_dtls_seq = c.Int(),
                        petition_dtls_seq = c.Int(),
                        pay_seq = c.Int(),
                        used_amount = c.Decimal(precision: 18, scale: 2),
                        cal_amount = c.Decimal(precision: 18, scale: 2),
                        rpt_type = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_proj_oper_rpt_seq)
                .ForeignKey("dbo.bgm_project_operation_expense", t => t.bgm_proj_oper_exp_seq)
                .ForeignKey("dbo.IcmPrePurchaseRequestItem", t => t.icm_ppr_item_seq)
                .ForeignKey("dbo.IcmPurchaseRequestItem", t => t.icm_pr_item_seq)
                .ForeignKey("dbo.IcmPurchaseOrderInstallmentItem", t => t.icm_po_install_item_seq)
                .ForeignKey("dbo.IcmDeliveryNoteItem", t => t.icm_dn_item_seq)
                .ForeignKey("dbo.FimPayRequestDtl", t => t.money_req_dtls_seq)
                .ForeignKey("dbo.FimReturnDtl", t => t.return_dtls_seq)
                .ForeignKey("dbo.FimPetitionDtl", t => t.petition_dtls_seq)
                .ForeignKey("dbo.FimPay", t => t.pay_seq)
                .Index(t => t.bgm_proj_oper_exp_seq)
                .Index(t => t.icm_ppr_item_seq)
                .Index(t => t.icm_pr_item_seq)
                .Index(t => t.icm_po_install_item_seq)
                .Index(t => t.icm_dn_item_seq)
                .Index(t => t.money_req_dtls_seq)
                .Index(t => t.return_dtls_seq)
                .Index(t => t.petition_dtls_seq)
                .Index(t => t.pay_seq);
            
            CreateTable(
                "dbo.IcmPrePurchaseRequestItem",
                c => new
                    {
                        PprItemId = c.Int(nullable: false, identity: true),
                        PprId = c.Int(nullable: false),
                        ProjOperExpId = c.Int(),
                        BgExpId = c.Int(),
                        BgSourceId = c.Int(),
                        RegularId = c.Int(),
                        ResItemId = c.Int(),
                        PrItemId = c.Int(),
                        Descr = c.String(),
                        Qty = c.Int(),
                        Price = c.Decimal(precision: 18, scale: 2),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        StdPrice = c.Decimal(precision: 18, scale: 2),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PprItemId)
                .ForeignKey("dbo.bgm_project_operation_expense", t => t.ProjOperExpId)
                .ForeignKey("dbo.IcmMasPurchaseRegular", t => t.RegularId)
                .ForeignKey("dbo.IcmMasResourceItem", t => t.ResItemId)
                .ForeignKey("dbo.IcmPrePurchaseRequest", t => t.PprId, cascadeDelete: true)
                .ForeignKey("dbo.IcmPurchaseRequestItem", t => t.PrItemId)
                .ForeignKey("dbo.bgm_mas_expense", t => t.BgExpId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId)
                .Index(t => t.ProjOperExpId)
                .Index(t => t.RegularId)
                .Index(t => t.ResItemId)
                .Index(t => t.PprId)
                .Index(t => t.PrItemId)
                .Index(t => t.BgExpId)
                .Index(t => t.BgSourceId);
            
            CreateTable(
                "dbo.IcmMasPurchaseRegular",
                c => new
                    {
                        RegularId = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        Description = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RegularId);
            
            CreateTable(
                "dbo.IcmPrePurchaseRequest",
                c => new
                    {
                        PprId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(nullable: false),
                        Reason = c.String(),
                        PriorityId = c.Int(nullable: false),
                        PcTypeId = c.Int(nullable: false),
                        YearTypeId = c.Int(nullable: false),
                        BgYear = c.Int(nullable: false),
                        RequestDate = c.DateTime(nullable: false),
                        RequestEmpId = c.Int(nullable: false),
                        RequestJobSiteId = c.Int(nullable: false),
                        RequireDate = c.DateTime(),
                        RequireDuration = c.Int(),
                        DurTypeId = c.Int(),
                        DurCountId = c.Int(),
                        ProgressId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PprId)
                .ForeignKey("dbo.IcmMasPurchaseType", t => t.PcTypeId, cascadeDelete: true)
                .ForeignKey("dbo.sys_year_type", t => t.YearTypeId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_ps_employees", t => t.RequestEmpId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_job_site", t => t.RequestJobSiteId, cascadeDelete: true)
                .ForeignKey("dbo.IcmMasLookUp", t => t.PriorityId, cascadeDelete: true)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurTypeId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurCountId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ProgressId)
                .Index(t => t.PcTypeId)
                .Index(t => t.YearTypeId)
                .Index(t => t.RequestEmpId)
                .Index(t => t.RequestJobSiteId)
                .Index(t => t.PriorityId)
                .Index(t => t.DurTypeId)
                .Index(t => t.DurCountId)
                .Index(t => t.ProgressId);
            
            CreateTable(
                "dbo.IcmMasPurchaseType",
                c => new
                    {
                        PcTypeId = c.Int(nullable: false, identity: true),
                        PcTypeName = c.String(),
                        PcTypeDescr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        RestoredBy = c.Int(),
                        RestoredWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PcTypeId);
            
            CreateTable(
                "dbo.IcmPurchaseRequestItem",
                c => new
                    {
                        PrItemId = c.Int(nullable: false, identity: true),
                        BgExpId = c.Int(nullable: false),
                        PrId = c.Int(),
                        ResItemId = c.Int(),
                        Descr = c.String(),
                        OriQty = c.Int(),
                        MinPrice = c.Decimal(precision: 18, scale: 2),
                        MaxPrice = c.Decimal(precision: 18, scale: 2),
                        StdPrice = c.Decimal(precision: 18, scale: 2),
                        Qty = c.Int(),
                        Price = c.Decimal(precision: 18, scale: 2),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        RecordStatus = c.String(),
                    })
                .PrimaryKey(t => t.PrItemId)
                .ForeignKey("dbo.IcmPurchaseRequest", t => t.PrId)
                .ForeignKey("dbo.bgm_mas_expense", t => t.BgExpId, cascadeDelete: true)
                .ForeignKey("dbo.IcmMasResourceItem", t => t.ResItemId)
                .Index(t => t.PrId)
                .Index(t => t.BgExpId)
                .Index(t => t.ResItemId);
            
            CreateTable(
                "dbo.IcmPurchaseRequest",
                c => new
                    {
                        PrId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        Reason = c.String(),
                        Remark = c.String(),
                        RegularId = c.Int(),
                        PriorityId = c.Int(),
                        PcTypeId = c.Int(),
                        PcMethodId = c.Int(),
                        PcMethodReason = c.String(),
                        YearTypeId = c.Int(),
                        BgYear = c.Int(),
                        PurchaseDate = c.DateTime(),
                        PurchaseEmpId = c.Int(),
                        PurchaseJobSiteId = c.Int(),
                        ConfirmDate = c.DateTime(),
                        ConfirmEmpId = c.Int(),
                        CancelDate = c.DateTime(),
                        CancelEmpId = c.Int(),
                        RequireDate = c.DateTime(),
                        RequireDuration = c.Int(),
                        DurTypeId = c.Int(),
                        DurCountId = c.Int(),
                        ProgressId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PrId)
                .ForeignKey("dbo.IcmMasPurchaseRegular", t => t.RegularId)
                .ForeignKey("dbo.IcmMasPurchaseType", t => t.PcTypeId)
                .ForeignKey("dbo.IcmMasPurchaseMethod", t => t.PcMethodId)
                .ForeignKey("dbo.sys_year_type", t => t.YearTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.PurchaseEmpId)
                .ForeignKey("dbo.hrm_job_site", t => t.PurchaseJobSiteId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.ConfirmEmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.CancelEmpId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.PriorityId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurTypeId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurCountId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ProgressId)
                .Index(t => t.RegularId)
                .Index(t => t.PcTypeId)
                .Index(t => t.PcMethodId)
                .Index(t => t.YearTypeId)
                .Index(t => t.PurchaseEmpId)
                .Index(t => t.PurchaseJobSiteId)
                .Index(t => t.ConfirmEmpId)
                .Index(t => t.CancelEmpId)
                .Index(t => t.PriorityId)
                .Index(t => t.DurTypeId)
                .Index(t => t.DurCountId)
                .Index(t => t.ProgressId);
            
            CreateTable(
                "dbo.IcmMasPurchaseMethod",
                c => new
                    {
                        PcMethodId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Descr = c.String(),
                        Reason = c.String(),
                        PcTypeId = c.Int(nullable: false),
                        IsBid = c.Boolean(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PcMethodId)
                .ForeignKey("dbo.IcmMasPurchaseType", t => t.PcTypeId, cascadeDelete: true)
                .Index(t => t.PcTypeId);
            
            CreateTable(
                "dbo.IcmPurchaseOrderInstallmentItem",
                c => new
                    {
                        PoInstallItemId = c.Int(nullable: false, identity: true),
                        PoInstallId = c.Int(nullable: false),
                        BidderQuoId = c.Int(nullable: false),
                        Descr = c.String(),
                        Qty = c.Int(),
                        ItemPriceExcludeVat = c.Double(),
                        ItemPriceIncludeVat = c.Double(),
                        ExcludeVatAmount = c.Double(),
                        VatAmount = c.Double(),
                        NetAmount = c.Double(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PoInstallItemId)
                .ForeignKey("dbo.IcmBidderQuotation", t => t.BidderQuoId, cascadeDelete: true)
                .ForeignKey("dbo.IcmPurchaseOrderInstallment", t => t.PoInstallId, cascadeDelete: true)
                .Index(t => t.BidderQuoId)
                .Index(t => t.PoInstallId);
            
            CreateTable(
                "dbo.IcmBidderQuotation",
                c => new
                    {
                        BidderQuoId = c.Int(nullable: false, identity: true),
                        BidderId = c.Int(),
                        PrItemId = c.Int(),
                        Descr = c.String(),
                        Qty = c.Int(),
                        Price = c.Decimal(precision: 18, scale: 2),
                        ExcludeVatAmount = c.Decimal(precision: 18, scale: 2),
                        VatAmount = c.Decimal(precision: 18, scale: 2),
                        DiscountPercent = c.Decimal(precision: 18, scale: 2),
                        ExtraDiscount = c.Decimal(precision: 18, scale: 2),
                        NetAmount = c.Decimal(precision: 18, scale: 2),
                        Remarks = c.String(),
                        Selected = c.String(),
                        SelectedReason = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BidderQuoId)
                .ForeignKey("dbo.IcmBidder", t => t.BidderId)
                .ForeignKey("dbo.IcmPurchaseRequestItem", t => t.PrItemId)
                .Index(t => t.BidderId)
                .Index(t => t.PrItemId);
            
            CreateTable(
                "dbo.IcmBidder",
                c => new
                    {
                        BidderId = c.Int(nullable: false, identity: true),
                        ConId = c.Int(nullable: false),
                        BidId = c.Int(),
                        PrId = c.Int(),
                        ReceiveDate = c.DateTime(),
                        ReceiptNo = c.String(),
                        OfferDate = c.DateTime(),
                        BidderDate = c.DateTime(),
                        DueDate = c.DateTime(),
                        DueDay = c.Int(),
                        DurTypeId = c.Int(),
                        VatPercent = c.Double(),
                        VatTypeId = c.Int(),
                        ReceiveStatus = c.String(),
                        OfferStatus = c.String(),
                        WinnerStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BidderId)
                .ForeignKey("dbo.IcmMasContact", t => t.ConId, cascadeDelete: true)
                .ForeignKey("dbo.IcmBid", t => t.BidId)
                .ForeignKey("dbo.IcmPurchaseRequest", t => t.PrId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurTypeId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.VatTypeId)
                .Index(t => t.ConId)
                .Index(t => t.BidId)
                .Index(t => t.PrId)
                .Index(t => t.DurTypeId)
                .Index(t => t.VatTypeId);
            
            CreateTable(
                "dbo.IcmBid",
                c => new
                    {
                        BidId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        PrId = c.Int(nullable: false),
                        YearTypeId = c.Int(),
                        BgYear = c.Int(),
                        BidDate = c.DateTime(),
                        BidEmpId = c.Int(),
                        BidJobSiteId = c.Int(),
                        ConfirmDate = c.DateTime(),
                        ConfirmEmpId = c.Int(),
                        CancelDate = c.DateTime(),
                        CancelEmpId = c.Int(),
                        AnnounceDate = c.DateTime(),
                        ReceiveDateStart = c.DateTime(),
                        ReceiveDateEnd = c.DateTime(),
                        BuildingDate = c.DateTime(),
                        ExplainDate = c.DateTime(),
                        OfferDateStart = c.DateTime(),
                        OfferDateEnd = c.DateTime(),
                        DiscloseDate = c.DateTime(),
                        ReceiveTimeStart = c.Time(),
                        ReceiveTimeEnd = c.Time(),
                        BuildingTimeStart = c.Time(),
                        BuildingTimeEnd = c.Time(),
                        ExplainTime = c.Time(),
                        OfferTimeStart = c.Time(),
                        OfferTimeEnd = c.Time(),
                        DiscloseTime = c.Time(),
                        ReceivePlace = c.String(),
                        OfferPlace = c.String(),
                        DisclosePlace = c.String(),
                        ReceiveType = c.String(),
                        DocumentAmount = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        ApprovedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BidId)
                .ForeignKey("dbo.IcmPurchaseRequest", t => t.PrId, cascadeDelete: true)
                .ForeignKey("dbo.sys_year_type", t => t.YearTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.BidEmpId)
                .ForeignKey("dbo.hrm_job_site", t => t.BidJobSiteId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.ConfirmEmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.CancelEmpId)
                .Index(t => t.PrId)
                .Index(t => t.YearTypeId)
                .Index(t => t.BidEmpId)
                .Index(t => t.BidJobSiteId)
                .Index(t => t.ConfirmEmpId)
                .Index(t => t.CancelEmpId);
            
            CreateTable(
                "dbo.IcmPurchaseOrderInstallment",
                c => new
                    {
                        PoInstallId = c.Int(nullable: false, identity: true),
                        PoId = c.Int(),
                        InstallNumber = c.Int(),
                        DeliveryDate = c.DateTime(),
                        Remarks = c.String(),
                        RedemptionAmount = c.Double(),
                        DeductionAmount = c.Double(),
                        RequireDuration = c.Int(),
                        DurTypeId = c.Int(),
                        RequireDate = c.DateTime(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PoInstallId)
                .ForeignKey("dbo.IcmPurchaseOrder", t => t.PoId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurTypeId)
                .Index(t => t.PoId)
                .Index(t => t.DurTypeId);
            
            CreateTable(
                "dbo.IcmPurchaseOrder",
                c => new
                    {
                        PoId = c.Int(nullable: false, identity: true),
                        BidderId = c.Int(),
                        Gfmis = c.String(),
                        Code = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        PcTypeId = c.Int(),
                        CanInstallment = c.String(),
                        CanSeparateDetail = c.String(),
                        NotSeparateReason = c.String(),
                        PenaltyType = c.String(),
                        RequireDuration = c.Int(),
                        RequireDate = c.DateTime(),
                        DurTypeId = c.Int(),
                        DateStartCount = c.DateTime(),
                        DeliveryDate = c.DateTime(),
                        PrepayAmount = c.Double(),
                        RedemptionPercent = c.Double(),
                        DateReturnPrepay = c.DateTime(),
                        DateReturnContract = c.DateTime(),
                        DateReturnRedemption = c.DateTime(),
                        OrderDate = c.DateTime(),
                        YearTypeId = c.Int(),
                        BgYear = c.Int(),
                        ProgressId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PoId)
                .ForeignKey("dbo.IcmBidder", t => t.BidderId)
                .ForeignKey("dbo.IcmMasPurchaseType", t => t.PcTypeId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.DurTypeId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ProgressId)
                .ForeignKey("dbo.sys_year_type", t => t.YearTypeId)
                .Index(t => t.BidderId)
                .Index(t => t.PcTypeId)
                .Index(t => t.DurTypeId)
                .Index(t => t.ProgressId)
                .Index(t => t.YearTypeId);
            
            CreateTable(
                "dbo.IcmDeliveryNoteItem",
                c => new
                    {
                        DnItemId = c.Int(nullable: false, identity: true),
                        DnId = c.Int(),
                        PoInstallItemId = c.Int(),
                        ResItemId = c.Int(),
                        ItemQty = c.Int(),
                        NumberOfcount = c.Int(),
                        Descr = c.String(),
                        ItemPriceExcludeVat = c.Double(),
                        ItemPriceIncludeVat = c.Double(),
                        Remarks = c.String(),
                        ExcludeVatAmount = c.Double(),
                        VatAmount = c.Double(),
                        NetAmount = c.Double(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DnItemId)
                .ForeignKey("dbo.IcmDeliveryNote", t => t.DnId)
                .ForeignKey("dbo.IcmPurchaseOrderInstallmentItem", t => t.PoInstallItemId)
                .ForeignKey("dbo.IcmMasResourceItem", t => t.ResItemId)
                .Index(t => t.DnId)
                .Index(t => t.PoInstallItemId)
                .Index(t => t.ResItemId);
            
            CreateTable(
                "dbo.IcmDeliveryNote",
                c => new
                    {
                        DnId = c.Int(nullable: false, identity: true),
                        PoId = c.Int(),
                        PoInstallId = c.Int(),
                        Code = c.String(),
                        Name = c.String(),
                        Descr = c.String(),
                        ReceiveDate = c.DateTime(),
                        InvoiceNumber = c.String(),
                        InvoiceDate = c.DateTime(),
                        WhId = c.Int(),
                        DocumentNumber = c.String(),
                        RedemptionAmount = c.Double(),
                        DeductionAmount = c.Double(),
                        YearTypeId = c.Int(),
                        BgYear = c.Int(),
                        DeliveryDate = c.DateTime(),
                        DeliveryEmpId = c.Int(),
                        DeliveryJobSiteId = c.Int(),
                        DeliveryPlace = c.String(),
                        ProgId = c.Int(),
                        TranGrpId = c.Int(),
                        ProjOperExpId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DnId)
                .ForeignKey("dbo.bgm_project_operation_expense", t => t.ProjOperExpId)
                .ForeignKey("dbo.IcmPurchaseOrder", t => t.PoId)
                .ForeignKey("dbo.IcmPurchaseOrderInstallment", t => t.PoInstallId)
                .ForeignKey("dbo.IcmWarehouse", t => t.WhId)
                .ForeignKey("dbo.sys_year_type", t => t.YearTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.DeliveryEmpId)
                .ForeignKey("dbo.hrm_job_site", t => t.DeliveryJobSiteId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ProgId)
                .ForeignKey("dbo.AcmTransectionGroup", t => t.TranGrpId)
                .Index(t => t.ProjOperExpId)
                .Index(t => t.PoId)
                .Index(t => t.PoInstallId)
                .Index(t => t.WhId)
                .Index(t => t.YearTypeId)
                .Index(t => t.DeliveryEmpId)
                .Index(t => t.DeliveryJobSiteId)
                .Index(t => t.ProgId)
                .Index(t => t.TranGrpId);
            
            CreateTable(
                "dbo.IcmWarehouse",
                c => new
                    {
                        WhId = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        Description = c.String(),
                        ScopeId = c.Int(nullable: false),
                        JobSiteId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.WhId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ScopeId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.ScopeId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.FimPayRequestDtl",
                c => new
                    {
                        PayReqDtlId = c.Int(nullable: false, identity: true),
                        PayReqId = c.Int(nullable: false),
                        Name = c.String(),
                        ProjOperExpId = c.Int(),
                        JobSiteId = c.Int(),
                        PercentVat = c.Double(),
                        PercentTax = c.Double(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        AmountVat = c.Decimal(precision: 18, scale: 2),
                        AmountTax = c.Decimal(precision: 18, scale: 2),
                        NetAmount = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PayReqDtlId)
                .ForeignKey("dbo.FimPayRequest", t => t.PayReqId, cascadeDelete: true)
                .ForeignKey("dbo.bgm_project_operation_expense", t => t.ProjOperExpId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.PayReqId)
                .Index(t => t.ProjOperExpId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.FimPayRequest",
                c => new
                    {
                        PayReqId = c.Int(nullable: false, identity: true),
                        BgSourceId = c.Int(nullable: false),
                        BgYear = c.Int(nullable: false),
                        WorkAreaId = c.Int(),
                        ExpGrpId = c.Int(),
                        PayEventId = c.Int(),
                        PayReqDate = c.DateTime(),
                        UseAdvance = c.String(),
                        AdvanceBgSourceId = c.Int(),
                        Code = c.String(),
                        DoccumentNo = c.String(),
                        Name = c.String(),
                        ProjOperId = c.Int(),
                        EmpId = c.Int(),
                        JobSiteId = c.Int(),
                        ContactId = c.Int(),
                        DnId = c.Int(),
                        BorrowNo = c.String(),
                        BorrowTypeId = c.Int(),
                        BorrowStartDate = c.DateTime(),
                        BorrowEndDate = c.DateTime(),
                        BorrowReturnDate = c.DateTime(),
                        CreditCardNo = c.String(),
                        Allow = c.String(),
                        DebtorEmpId = c.Int(),
                        DebtorContactId = c.Int(),
                        TranGrpId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PayReqId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.WorkAreaId)
                .ForeignKey("dbo.bgm_mas_expense_group", t => t.ExpGrpId)
                .ForeignKey("dbo.FimMasLookUp", t => t.PayEventId)
                .ForeignKey("dbo.bgm_mas_source", t => t.AdvanceBgSourceId)
                .ForeignKey("dbo.bgm_project_operation", t => t.ProjOperId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.IcmMasContact", t => t.ContactId)
                .ForeignKey("dbo.IcmDeliveryNote", t => t.DnId)
                .ForeignKey("dbo.FimMasLookUp", t => t.BorrowTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.DebtorEmpId)
                .ForeignKey("dbo.IcmMasContact", t => t.DebtorContactId)
                .ForeignKey("dbo.AcmTransectionGroup", t => t.TranGrpId)
                .Index(t => t.BgSourceId)
                .Index(t => t.WorkAreaId)
                .Index(t => t.ExpGrpId)
                .Index(t => t.PayEventId)
                .Index(t => t.AdvanceBgSourceId)
                .Index(t => t.ProjOperId)
                .Index(t => t.EmpId)
                .Index(t => t.JobSiteId)
                .Index(t => t.ContactId)
                .Index(t => t.DnId)
                .Index(t => t.BorrowTypeId)
                .Index(t => t.DebtorEmpId)
                .Index(t => t.DebtorContactId)
                .Index(t => t.TranGrpId);
            
            CreateTable(
                "dbo.FimReturnDtl",
                c => new
                    {
                        ReturnDtlId = c.Int(nullable: false, identity: true),
                        ReturnId = c.Int(),
                        PayReqDtlId = c.Int(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReturnDtlId)
                .ForeignKey("dbo.FimReturn", t => t.ReturnId)
                .ForeignKey("dbo.FimPayRequestDtl", t => t.PayReqDtlId)
                .Index(t => t.ReturnId)
                .Index(t => t.PayReqDtlId);
            
            CreateTable(
                "dbo.FimReturn",
                c => new
                    {
                        ReturnId = c.Int(nullable: false, identity: true),
                        ReturnDate = c.DateTime(),
                        Code = c.String(),
                        PayReqId = c.Int(),
                        TranGrpId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReturnId)
                .ForeignKey("dbo.FimPayRequest", t => t.PayReqId)
                .ForeignKey("dbo.AcmTransectionGroup", t => t.TranGrpId)
                .Index(t => t.PayReqId)
                .Index(t => t.TranGrpId);
            
            CreateTable(
                "dbo.FimPetitionDtl",
                c => new
                    {
                        PetitionDtlId = c.Int(nullable: false, identity: true),
                        PetitionId = c.Long(),
                        PayReqId = c.Int(),
                        JobSiteId = c.Int(),
                        Amount = c.Double(),
                        AmountTax = c.Double(),
                        AmountPenalty = c.Double(),
                        AmountRedemption = c.Double(),
                        AmountFund = c.Double(),
                        AmountReal = c.Double(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PetitionDtlId)
                .ForeignKey("dbo.FimPetition", t => t.PetitionId)
                .ForeignKey("dbo.FimPayRequest", t => t.PayReqId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.PetitionId)
                .Index(t => t.PayReqId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.FimPetition",
                c => new
                    {
                        PetitionId = c.Long(nullable: false, identity: true),
                        BgSourceId = c.Int(nullable: false),
                        BgYear = c.Int(nullable: false),
                        PetitionDate = c.DateTime(),
                        Code = c.String(),
                        DirectPay = c.Boolean(nullable: false),
                        PetitionTypeId = c.Int(nullable: false),
                        RealPetitionDate = c.DateTime(),
                        PetitionNo = c.String(),
                        TranGrpId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PetitionId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId, cascadeDelete: true)
                .ForeignKey("dbo.FimMasLookUp", t => t.PetitionTypeId, cascadeDelete: true)
                .ForeignKey("dbo.AcmTransectionGroup", t => t.TranGrpId)
                .Index(t => t.BgSourceId)
                .Index(t => t.PetitionTypeId)
                .Index(t => t.TranGrpId);
            
            CreateTable(
                "dbo.FimPay",
                c => new
                    {
                        PayId = c.Int(nullable: false, identity: true),
                        BgSourceId = c.Int(nullable: false),
                        WorkAreaId = c.Int(nullable: false),
                        BgYear = c.Int(nullable: false),
                        PayEventId = c.Int(nullable: false),
                        PayDate = c.DateTime(),
                        RealPayDate = c.DateTime(),
                        Code = c.String(),
                        ReceiptNo = c.String(),
                        ReceiptName = c.String(),
                        Name = c.String(),
                        PayMethodId = c.Int(),
                        PayReqId = c.Int(),
                        PetitionId = c.Long(),
                        PetitionDtlId = c.Int(),
                        EmpId = c.Int(),
                        ContactId = c.Int(),
                        TempContactName = c.String(),
                        BidderColId = c.Int(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        VatRate = c.Decimal(precision: 18, scale: 2),
                        Vat = c.Decimal(precision: 18, scale: 2),
                        TaxRate = c.Decimal(precision: 18, scale: 2),
                        Tax = c.Decimal(precision: 18, scale: 2),
                        NetAmount = c.Decimal(precision: 18, scale: 2),
                        PostPayId = c.Int(),
                        TranGrpId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PayId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.WorkAreaId, cascadeDelete: true)
                .ForeignKey("dbo.FimMasLookUp", t => t.PayEventId, cascadeDelete: true)
                .ForeignKey("dbo.FimMasLookUp", t => t.PayMethodId)
                .ForeignKey("dbo.FimPayRequest", t => t.PayReqId)
                .ForeignKey("dbo.FimPetition", t => t.PetitionId)
                .ForeignKey("dbo.FimPetitionDtl", t => t.PetitionDtlId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.IcmMasContact", t => t.ContactId)
                .ForeignKey("dbo.IcmBidderCollateral", t => t.BidderColId)
                .ForeignKey("dbo.FimPay", t => t.PostPayId)
                .ForeignKey("dbo.AcmTransectionGroup", t => t.TranGrpId)
                .Index(t => t.BgSourceId)
                .Index(t => t.WorkAreaId)
                .Index(t => t.PayEventId)
                .Index(t => t.PayMethodId)
                .Index(t => t.PayReqId)
                .Index(t => t.PetitionId)
                .Index(t => t.PetitionDtlId)
                .Index(t => t.EmpId)
                .Index(t => t.ContactId)
                .Index(t => t.BidderColId)
                .Index(t => t.PostPayId)
                .Index(t => t.TranGrpId);
            
            CreateTable(
                "dbo.IcmBidderCollateral",
                c => new
                    {
                        BidderColId = c.Int(nullable: false, identity: true),
                        ColTypeId = c.Int(),
                        Code = c.String(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        Descr = c.String(),
                        BidderId = c.Int(),
                        ReceiptNo = c.String(),
                        ReturnDate = c.DateTime(),
                        ColStatusId = c.Int(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        ColCategoryId = c.Int(),
                    })
                .PrimaryKey(t => t.BidderColId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ColTypeId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ColStatusId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.ColCategoryId)
                .ForeignKey("dbo.IcmBidder", t => t.BidderId)
                .Index(t => t.ColTypeId)
                .Index(t => t.ColStatusId)
                .Index(t => t.ColCategoryId)
                .Index(t => t.BidderId);
            
            CreateTable(
                "dbo.bgm_mas_scopes",
                c => new
                    {
                        bgm_scope_seq = c.Int(nullable: false, identity: true),
                        bgm_scope_name = c.String(storeType: "ntext"),
                        remarks = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_scope_seq);
            
            CreateTable(
                "dbo.bgm_project_type",
                c => new
                    {
                        prj_type_seq = c.Int(nullable: false, identity: true),
                        prj_type_name = c.String(storeType: "ntext"),
                        prj_type_descr = c.String(storeType: "ntext"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.prj_type_seq);
            
            CreateTable(
                "dbo.bgm_strategy_data_list",
                c => new
                    {
                        bgm_strat_list_seq = c.Int(nullable: false, identity: true),
                        bgm_strat_list_code = c.String(storeType: "ntext"),
                        bgm_strat_list_name = c.String(storeType: "ntext"),
                        bgm_strat_list_descr = c.String(storeType: "ntext"),
                        bgm_strat_type_seq = c.Int(),
                        gfmis_code = c.String(storeType: "ntext"),
                        year_start = c.Int(),
                        year_end = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_strat_list_seq)
                .ForeignKey("dbo.bgm_mas_strategy_type", t => t.bgm_strat_type_seq)
                .Index(t => t.bgm_strat_type_seq);
            
            CreateTable(
                "dbo.bgm_mas_strategy_type",
                c => new
                    {
                        bgm_strat_type_seq = c.Int(nullable: false, identity: true),
                        bgm_strat_type_code = c.String(storeType: "ntext"),
                        bgm_strat_type_name = c.String(storeType: "ntext"),
                        bgm_strat_type_descr = c.String(storeType: "ntext"),
                        is_root = c.Int(),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_strat_type_seq);
            
            CreateTable(
                "dbo.bgm_system_control",
                c => new
                    {
                        id = c.Int(nullable: false, identity: true),
                        bgm_sys_control_name = c.String(storeType: "ntext"),
                        bgm_sys_control_values = c.String(storeType: "ntext"),
                    })
                .PrimaryKey(t => t.id);
            
            CreateTable(
                "dbo.FimMasExpenseRate",
                c => new
                    {
                        ExpRateId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Descr = c.String(),
                        BgExpId = c.Int(),
                        BgSourceId = c.Int(),
                        AmountMax = c.Double(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ExpRateId)
                .ForeignKey("dbo.bgm_mas_expense", t => t.BgExpId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId)
                .Index(t => t.BgExpId)
                .Index(t => t.BgSourceId);
            
            CreateTable(
                "dbo.FimMasBankAccountType",
                c => new
                    {
                        BankAccTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        BankAccTypeGrpId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BankAccTypeId);
            
            CreateTable(
                "dbo.FimMasBankAccountTypeGroup",
                c => new
                    {
                        BankAccTypeGrpId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BankAccTypeGrpId);
            
            CreateTable(
                "dbo.FimMasReceiveType",
                c => new
                    {
                        ReceiveTypeId = c.Int(nullable: false, identity: true),
                        BgSourceId = c.Int(nullable: false),
                        Name = c.String(),
                        BankAccId = c.Int(),
                        AccountId = c.Int(),
                        InvConnectType = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReceiveTypeId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId, cascadeDelete: true)
                .ForeignKey("dbo.FimMasBankAccount", t => t.BankAccId)
                .ForeignKey("dbo.AcmMasAccount", t => t.AccountId)
                .Index(t => t.BgSourceId)
                .Index(t => t.BankAccId)
                .Index(t => t.AccountId);
            
            CreateTable(
                "dbo.FimMasBorrowType",
                c => new
                    {
                        BorrowTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        BgSourceId = c.Int(),
                        CalDateType = c.String(),
                        ReturnDay = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BorrowTypeId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId)
                .Index(t => t.BgSourceId);
            
            CreateTable(
                "dbo.FimChequeBook",
                c => new
                    {
                        ChequeBookId = c.Int(nullable: false, identity: true),
                        Code = c.String(),
                        BankAccId = c.Int(nullable: false),
                        StartChequeNo = c.Int(nullable: false),
                        EndChequeNo = c.Int(nullable: false),
                        Remarks = c.String(),
                        ChequeBookStatus = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ChequeBookId)
                .ForeignKey("dbo.FimMasBankAccount", t => t.BankAccId, cascadeDelete: true)
                .Index(t => t.BankAccId);
            
            CreateTable(
                "dbo.FimCheque",
                c => new
                    {
                        ChequeId = c.Int(nullable: false, identity: true),
                        ChequeBookId = c.Int(nullable: false),
                        ChequeNo = c.Int(nullable: false),
                        PrintDate = c.DateTime(),
                        PayDate = c.DateTime(),
                        Receiver = c.String(),
                        Remarks = c.String(),
                        ChequeStatus = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ChequeId)
                .ForeignKey("dbo.FimChequeBook", t => t.ChequeBookId, cascadeDelete: true)
                .Index(t => t.ChequeBookId);
            
            CreateTable(
                "dbo.FimPayRequestDtlRate",
                c => new
                    {
                        PayReqDtlRateId = c.Int(nullable: false, identity: true),
                        PayRequestDtlId = c.Int(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PayReqDtlRateId)
                .ForeignKey("dbo.FimPayRequestDtl", t => t.PayRequestDtlId)
                .Index(t => t.PayRequestDtlId);
            
            CreateTable(
                "dbo.FimPayCheque",
                c => new
                    {
                        PayChequeId = c.Int(nullable: false, identity: true),
                        PayId = c.Int(nullable: false),
                        ChequeId = c.Int(nullable: false),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PayChequeId)
                .ForeignKey("dbo.FimPay", t => t.PayId, cascadeDelete: true)
                .ForeignKey("dbo.FimCheque", t => t.ChequeId, cascadeDelete: true)
                .Index(t => t.PayId)
                .Index(t => t.ChequeId);
            
            CreateTable(
                "dbo.FimReceive",
                c => new
                    {
                        ReceiveId = c.Long(nullable: false, identity: true),
                        BgSourceId = c.Int(nullable: false),
                        WorkAreaId = c.Int(),
                        BgYear = c.Int(nullable: false),
                        ReceiveTypeId = c.Int(),
                        ReceiptNo = c.String(),
                        ReceiveDate = c.DateTime(),
                        ManualReceipt = c.Boolean(nullable: false),
                        ReceiveMode = c.String(),
                        ReceiveMethodId = c.Int(),
                        ChequeNo = c.String(),
                        BranchId = c.Int(),
                        BankAccId = c.Int(),
                        ContactId = c.Int(),
                        EmpId = c.Int(),
                        TempContact = c.String(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        ReceivedBy = c.Int(),
                        Remarks = c.String(),
                        BidderId = c.Int(),
                        BidOfferColId = c.Int(),
                        PoColId = c.Int(),
                        PrePayColId = c.Int(),
                        DnPenId = c.Int(),
                        PoInstalId = c.Int(),
                        TranGrpId = c.Int(),
                        TransferId = c.Int(),
                        PetitionId = c.Long(),
                        PayReqId = c.Int(),
                        PayId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReceiveId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasWorkArea", t => t.WorkAreaId)
                .ForeignKey("dbo.FimMasReceiveType", t => t.ReceiveTypeId)
                .ForeignKey("dbo.FimMasLookUp", t => t.ReceiveMethodId)
                .ForeignKey("dbo.FimMasBankBranch", t => t.BranchId)
                .ForeignKey("dbo.FimMasBankAccount", t => t.BankAccId)
                .ForeignKey("dbo.IcmMasContact", t => t.ContactId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.IcmBidder", t => t.BidderId)
                .ForeignKey("dbo.IcmBidderCollateral", t => t.BidOfferColId)
                .ForeignKey("dbo.IcmBidderCollateral", t => t.PoColId)
                .ForeignKey("dbo.IcmBidderCollateral", t => t.PrePayColId)
                .ForeignKey("dbo.IcmDeliveryNotePenalty", t => t.DnPenId)
                .ForeignKey("dbo.IcmPurchaseOrderInstallment", t => t.PoInstalId)
                .ForeignKey("dbo.AcmTransectionGroup", t => t.TranGrpId)
                .ForeignKey("dbo.FimTransfer", t => t.TransferId)
                .ForeignKey("dbo.FimPetition", t => t.PetitionId)
                .ForeignKey("dbo.FimPayRequest", t => t.PayReqId)
                .ForeignKey("dbo.FimPay", t => t.PayId)
                .Index(t => t.BgSourceId)
                .Index(t => t.WorkAreaId)
                .Index(t => t.ReceiveTypeId)
                .Index(t => t.ReceiveMethodId)
                .Index(t => t.BranchId)
                .Index(t => t.BankAccId)
                .Index(t => t.ContactId)
                .Index(t => t.EmpId)
                .Index(t => t.BidderId)
                .Index(t => t.BidOfferColId)
                .Index(t => t.PoColId)
                .Index(t => t.PrePayColId)
                .Index(t => t.DnPenId)
                .Index(t => t.PoInstalId)
                .Index(t => t.TranGrpId)
                .Index(t => t.TransferId)
                .Index(t => t.PetitionId)
                .Index(t => t.PayReqId)
                .Index(t => t.PayId);
            
            CreateTable(
                "dbo.IcmDeliveryNotePenalty",
                c => new
                    {
                        DnPenId = c.Int(nullable: false, identity: true),
                        DnId = c.Int(),
                        PoPenId = c.Int(),
                        Remarks = c.String(),
                        PenaltyCalculate = c.Int(),
                        PenaltyAmount = c.Double(),
                        PenaltyFinalAmount = c.Double(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DnPenId)
                .ForeignKey("dbo.IcmDeliveryNote", t => t.DnId)
                .ForeignKey("dbo.IcmPurchaseOrderPenalty", t => t.PoPenId)
                .Index(t => t.DnId)
                .Index(t => t.PoPenId);
            
            CreateTable(
                "dbo.IcmPurchaseOrderPenalty",
                c => new
                    {
                        PoPenId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Descr = c.String(),
                        PenaltyRate = c.Double(),
                        RateTypeId = c.Int(),
                        PenaltyLeast = c.Double(),
                        PoId = c.Int(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PoPenId)
                .ForeignKey("dbo.IcmPurchaseOrder", t => t.PoId)
                .ForeignKey("dbo.IcmMasLookUp", t => t.RateTypeId)
                .Index(t => t.PoId)
                .Index(t => t.RateTypeId);
            
            CreateTable(
                "dbo.FimEmployeeTax",
                c => new
                    {
                        EmpTaxId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        FundTypeId = c.Int(),
                        FundPlusPer = c.Double(),
                        InsAmount = c.Double(),
                        RmfAmount = c.Double(),
                        LtfAmount = c.Double(),
                        LoanAmount = c.Double(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EmpTaxId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.FimMasFund", t => t.FundTypeId)
                .Index(t => t.EmpId)
                .Index(t => t.FundTypeId);
            
            CreateTable(
                "dbo.FimMasFund",
                c => new
                    {
                        FundId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        ConId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FundId)
                .ForeignKey("dbo.IcmMasContact", t => t.ConId)
                .Index(t => t.ConId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.FimMasFund", new[] { "ConId" });
            DropIndex("dbo.FimEmployeeTax", new[] { "FundTypeId" });
            DropIndex("dbo.FimEmployeeTax", new[] { "EmpId" });
            DropIndex("dbo.IcmPurchaseOrderPenalty", new[] { "RateTypeId" });
            DropIndex("dbo.IcmPurchaseOrderPenalty", new[] { "PoId" });
            DropIndex("dbo.IcmDeliveryNotePenalty", new[] { "PoPenId" });
            DropIndex("dbo.IcmDeliveryNotePenalty", new[] { "DnId" });
            DropIndex("dbo.FimReceive", new[] { "PayId" });
            DropIndex("dbo.FimReceive", new[] { "PayReqId" });
            DropIndex("dbo.FimReceive", new[] { "PetitionId" });
            DropIndex("dbo.FimReceive", new[] { "TransferId" });
            DropIndex("dbo.FimReceive", new[] { "TranGrpId" });
            DropIndex("dbo.FimReceive", new[] { "PoInstalId" });
            DropIndex("dbo.FimReceive", new[] { "DnPenId" });
            DropIndex("dbo.FimReceive", new[] { "PrePayColId" });
            DropIndex("dbo.FimReceive", new[] { "PoColId" });
            DropIndex("dbo.FimReceive", new[] { "BidOfferColId" });
            DropIndex("dbo.FimReceive", new[] { "BidderId" });
            DropIndex("dbo.FimReceive", new[] { "EmpId" });
            DropIndex("dbo.FimReceive", new[] { "ContactId" });
            DropIndex("dbo.FimReceive", new[] { "BankAccId" });
            DropIndex("dbo.FimReceive", new[] { "BranchId" });
            DropIndex("dbo.FimReceive", new[] { "ReceiveMethodId" });
            DropIndex("dbo.FimReceive", new[] { "ReceiveTypeId" });
            DropIndex("dbo.FimReceive", new[] { "WorkAreaId" });
            DropIndex("dbo.FimReceive", new[] { "BgSourceId" });
            DropIndex("dbo.FimPayCheque", new[] { "ChequeId" });
            DropIndex("dbo.FimPayCheque", new[] { "PayId" });
            DropIndex("dbo.FimPayRequestDtlRate", new[] { "PayRequestDtlId" });
            DropIndex("dbo.FimCheque", new[] { "ChequeBookId" });
            DropIndex("dbo.FimChequeBook", new[] { "BankAccId" });
            DropIndex("dbo.FimMasBorrowType", new[] { "BgSourceId" });
            DropIndex("dbo.FimMasReceiveType", new[] { "AccountId" });
            DropIndex("dbo.FimMasReceiveType", new[] { "BankAccId" });
            DropIndex("dbo.FimMasReceiveType", new[] { "BgSourceId" });
            DropIndex("dbo.FimMasExpenseRate", new[] { "BgSourceId" });
            DropIndex("dbo.FimMasExpenseRate", new[] { "BgExpId" });
            DropIndex("dbo.bgm_strategy_data_list", new[] { "bgm_strat_type_seq" });
            DropIndex("dbo.IcmBidderCollateral", new[] { "BidderId" });
            DropIndex("dbo.IcmBidderCollateral", new[] { "ColCategoryId" });
            DropIndex("dbo.IcmBidderCollateral", new[] { "ColStatusId" });
            DropIndex("dbo.IcmBidderCollateral", new[] { "ColTypeId" });
            DropIndex("dbo.FimPay", new[] { "TranGrpId" });
            DropIndex("dbo.FimPay", new[] { "PostPayId" });
            DropIndex("dbo.FimPay", new[] { "BidderColId" });
            DropIndex("dbo.FimPay", new[] { "ContactId" });
            DropIndex("dbo.FimPay", new[] { "EmpId" });
            DropIndex("dbo.FimPay", new[] { "PetitionDtlId" });
            DropIndex("dbo.FimPay", new[] { "PetitionId" });
            DropIndex("dbo.FimPay", new[] { "PayReqId" });
            DropIndex("dbo.FimPay", new[] { "PayMethodId" });
            DropIndex("dbo.FimPay", new[] { "PayEventId" });
            DropIndex("dbo.FimPay", new[] { "WorkAreaId" });
            DropIndex("dbo.FimPay", new[] { "BgSourceId" });
            DropIndex("dbo.FimPetition", new[] { "TranGrpId" });
            DropIndex("dbo.FimPetition", new[] { "PetitionTypeId" });
            DropIndex("dbo.FimPetition", new[] { "BgSourceId" });
            DropIndex("dbo.FimPetitionDtl", new[] { "JobSiteId" });
            DropIndex("dbo.FimPetitionDtl", new[] { "PayReqId" });
            DropIndex("dbo.FimPetitionDtl", new[] { "PetitionId" });
            DropIndex("dbo.FimReturn", new[] { "TranGrpId" });
            DropIndex("dbo.FimReturn", new[] { "PayReqId" });
            DropIndex("dbo.FimReturnDtl", new[] { "PayReqDtlId" });
            DropIndex("dbo.FimReturnDtl", new[] { "ReturnId" });
            DropIndex("dbo.FimPayRequest", new[] { "TranGrpId" });
            DropIndex("dbo.FimPayRequest", new[] { "DebtorContactId" });
            DropIndex("dbo.FimPayRequest", new[] { "DebtorEmpId" });
            DropIndex("dbo.FimPayRequest", new[] { "BorrowTypeId" });
            DropIndex("dbo.FimPayRequest", new[] { "DnId" });
            DropIndex("dbo.FimPayRequest", new[] { "ContactId" });
            DropIndex("dbo.FimPayRequest", new[] { "JobSiteId" });
            DropIndex("dbo.FimPayRequest", new[] { "EmpId" });
            DropIndex("dbo.FimPayRequest", new[] { "ProjOperId" });
            DropIndex("dbo.FimPayRequest", new[] { "AdvanceBgSourceId" });
            DropIndex("dbo.FimPayRequest", new[] { "PayEventId" });
            DropIndex("dbo.FimPayRequest", new[] { "ExpGrpId" });
            DropIndex("dbo.FimPayRequest", new[] { "WorkAreaId" });
            DropIndex("dbo.FimPayRequest", new[] { "BgSourceId" });
            DropIndex("dbo.FimPayRequestDtl", new[] { "JobSiteId" });
            DropIndex("dbo.FimPayRequestDtl", new[] { "ProjOperExpId" });
            DropIndex("dbo.FimPayRequestDtl", new[] { "PayReqId" });
            DropIndex("dbo.IcmWarehouse", new[] { "JobSiteId" });
            DropIndex("dbo.IcmWarehouse", new[] { "ScopeId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "TranGrpId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "ProgId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "DeliveryJobSiteId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "DeliveryEmpId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "YearTypeId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "WhId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "PoInstallId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "PoId" });
            DropIndex("dbo.IcmDeliveryNote", new[] { "ProjOperExpId" });
            DropIndex("dbo.IcmDeliveryNoteItem", new[] { "ResItemId" });
            DropIndex("dbo.IcmDeliveryNoteItem", new[] { "PoInstallItemId" });
            DropIndex("dbo.IcmDeliveryNoteItem", new[] { "DnId" });
            DropIndex("dbo.IcmPurchaseOrder", new[] { "YearTypeId" });
            DropIndex("dbo.IcmPurchaseOrder", new[] { "ProgressId" });
            DropIndex("dbo.IcmPurchaseOrder", new[] { "DurTypeId" });
            DropIndex("dbo.IcmPurchaseOrder", new[] { "PcTypeId" });
            DropIndex("dbo.IcmPurchaseOrder", new[] { "BidderId" });
            DropIndex("dbo.IcmPurchaseOrderInstallment", new[] { "DurTypeId" });
            DropIndex("dbo.IcmPurchaseOrderInstallment", new[] { "PoId" });
            DropIndex("dbo.IcmBid", new[] { "CancelEmpId" });
            DropIndex("dbo.IcmBid", new[] { "ConfirmEmpId" });
            DropIndex("dbo.IcmBid", new[] { "BidJobSiteId" });
            DropIndex("dbo.IcmBid", new[] { "BidEmpId" });
            DropIndex("dbo.IcmBid", new[] { "YearTypeId" });
            DropIndex("dbo.IcmBid", new[] { "PrId" });
            DropIndex("dbo.IcmBidder", new[] { "VatTypeId" });
            DropIndex("dbo.IcmBidder", new[] { "DurTypeId" });
            DropIndex("dbo.IcmBidder", new[] { "PrId" });
            DropIndex("dbo.IcmBidder", new[] { "BidId" });
            DropIndex("dbo.IcmBidder", new[] { "ConId" });
            DropIndex("dbo.IcmBidderQuotation", new[] { "PrItemId" });
            DropIndex("dbo.IcmBidderQuotation", new[] { "BidderId" });
            DropIndex("dbo.IcmPurchaseOrderInstallmentItem", new[] { "PoInstallId" });
            DropIndex("dbo.IcmPurchaseOrderInstallmentItem", new[] { "BidderQuoId" });
            DropIndex("dbo.IcmMasPurchaseMethod", new[] { "PcTypeId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "ProgressId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "DurCountId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "DurTypeId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "PriorityId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "CancelEmpId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "ConfirmEmpId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "PurchaseJobSiteId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "PurchaseEmpId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "YearTypeId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "PcMethodId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "PcTypeId" });
            DropIndex("dbo.IcmPurchaseRequest", new[] { "RegularId" });
            DropIndex("dbo.IcmPurchaseRequestItem", new[] { "ResItemId" });
            DropIndex("dbo.IcmPurchaseRequestItem", new[] { "BgExpId" });
            DropIndex("dbo.IcmPurchaseRequestItem", new[] { "PrId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "ProgressId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "DurCountId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "DurTypeId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "PriorityId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "RequestJobSiteId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "RequestEmpId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "YearTypeId" });
            DropIndex("dbo.IcmPrePurchaseRequest", new[] { "PcTypeId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "BgSourceId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "BgExpId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "PrItemId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "PprId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "ResItemId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "RegularId" });
            DropIndex("dbo.IcmPrePurchaseRequestItem", new[] { "ProjOperExpId" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "pay_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "petition_dtls_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "return_dtls_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "money_req_dtls_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "icm_dn_item_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "icm_po_install_item_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "icm_pr_item_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "icm_ppr_item_seq" });
            DropIndex("dbo.bgm_project_operation_report", new[] { "bgm_proj_oper_exp_seq" });
            DropIndex("dbo.IcmMasLookUp", new[] { "LookUpTypeId" });
            DropIndex("dbo.IcmMasContact", new[] { "VatTypeId" });
            DropIndex("dbo.IcmMasContact", new[] { "ConStatusId" });
            DropIndex("dbo.IcmMasContact", new[] { "ConGrpId" });
            DropIndex("dbo.bgm_project_operation_person", new[] { "ContactId" });
            DropIndex("dbo.bgm_project_operation_person", new[] { "emp_seq" });
            DropIndex("dbo.bgm_project_operation_person", new[] { "bgm_proj_oper_seq" });
            DropIndex("dbo.bgm_project_operation", new[] { "job_site_seq" });
            DropIndex("dbo.bgm_project_operation", new[] { "emp_seq" });
            DropIndex("dbo.bgm_project_operation", new[] { "bgm_proj_seq" });
            DropIndex("dbo.bgm_project_operation_expense", new[] { "bgm_proj_exp_seq" });
            DropIndex("dbo.bgm_project_operation_expense", new[] { "bgm_proj_oper_seq" });
            DropIndex("dbo.bgm_project_report", new[] { "bgm_proj_oper_exp_seq" });
            DropIndex("dbo.bgm_project_report", new[] { "bgm_proj_exp_seq" });
            DropIndex("dbo.bgm_mas_option", new[] { "bgm_option_type_seq" });
            DropIndex("dbo.bgm_mas_option", new[] { "job_site_seq" });
            DropIndex("dbo.bgm_mas_option", new[] { "upper_bgm_option_seq" });
            DropIndex("dbo.bgm_project_option", new[] { "bgm_proj_seq" });
            DropIndex("dbo.bgm_project_option", new[] { "bgm_option_seq" });
            DropIndex("dbo.bgm_project_manager", new[] { "emp_seq" });
            DropIndex("dbo.bgm_project_manager", new[] { "bgm_proj_seq" });
            DropIndex("dbo.bgm_project_activity_plan", new[] { "bgm_proj_seq" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "CumdepreAccountId" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "ConsumeAccountId" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "BreakAccountId" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "DepreAccountId" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "AssetAccountId" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "DpTypeId" });
            DropIndex("dbo.IcmMasResourceGroup", new[] { "ResTypeId" });
            DropIndex("dbo.IcmMasResourceSubGroup", new[] { "DpTypeId" });
            DropIndex("dbo.IcmMasResourceSubGroup", new[] { "ResGrpId" });
            DropIndex("dbo.IcmMasResourceItem", new[] { "UnitId" });
            DropIndex("dbo.IcmMasResourceItem", new[] { "ResSubGrpId" });
            DropIndex("dbo.bgm_project_expense", new[] { "icm_res_item_seq" });
            DropIndex("dbo.bgm_project_expense", new[] { "bgm_exp_seq" });
            DropIndex("dbo.bgm_project_expense", new[] { "bgm_source_seq" });
            DropIndex("dbo.bgm_project_expense", new[] { "bgm_proj_seq" });
            DropIndex("dbo.bgm_mas_expense_source", new[] { "bgm_source_seq" });
            DropIndex("dbo.bgm_mas_expense_source", new[] { "bgm_exp_seq" });
            DropIndex("dbo.bgm_mas_expense", new[] { "account_seq" });
            DropIndex("dbo.bgm_mas_expense", new[] { "bgm_exp_grp_id_real" });
            DropIndex("dbo.bgm_mas_expense", new[] { "bgm_exp_grp_seq" });
            DropIndex("dbo.bgm_mas_expense", new[] { "upper_bgm_exp_seq" });
            DropIndex("dbo.AcmTransectionDtl", new[] { "AccountId" });
            DropIndex("dbo.AcmTransectionDtl", new[] { "TranId" });
            DropIndex("dbo.HrmFieldPosition", new[] { "PosTypeId" });
            DropIndex("dbo.HrmFieldPosition", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMasCity", new[] { "CountryId" });
            DropIndex("dbo.HrmMasAmphur", new[] { "ProvinceId" });
            DropIndex("dbo.HrmMasDistrict", new[] { "AmphurId" });
            DropIndex("dbo.HrmMasJobSiteType", new[] { "CurrentJobSiteId" });
            DropIndex("dbo.hrm_job_site", new[] { "JobSite_JobSiteId" });
            DropIndex("dbo.hrm_job_site", new[] { "job_site_status_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "country_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "city_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "provnce_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "district_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "job_site_level_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "work_area_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "job_site_type_seq" });
            DropIndex("dbo.hrm_job_site", new[] { "upper_job_site_seq" });
            DropIndex("dbo.hrm_position", new[] { "Position_PosId1" });
            DropIndex("dbo.hrm_position", new[] { "Position_PosId" });
            DropIndex("dbo.hrm_position", new[] { "pos_status_seq" });
            DropIndex("dbo.hrm_position", new[] { "emp_type_seq" });
            DropIndex("dbo.hrm_position", new[] { "exec_pos_seq" });
            DropIndex("dbo.hrm_position", new[] { "field_pos_seq" });
            DropIndex("dbo.hrm_position", new[] { "job_site_seq" });
            DropIndex("dbo.hrm_position", new[] { "working_upper_pos_seq" });
            DropIndex("dbo.hrm_position", new[] { "upper_pos_seq" });
            DropIndex("dbo.HrmMasPositionType", new[] { "EmpTypeId" });
            DropIndex("dbo.hrm_mas_class", new[] { "emp_type_seq" });
            DropIndex("dbo.hrm_mas_class", new[] { "pos_type_seq" });
            DropIndex("dbo.hrm_mas_employee_type", new[] { "year_type_seq" });
            DropIndex("dbo.HrmMasNamePrefix", new[] { "GenderId" });
            DropIndex("dbo.hrm_ps_employees", new[] { "marital_status_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "exec_pos_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "emp_status_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "working_job_site_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "pos_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "class_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "EmpTypeId" });
            DropIndex("dbo.hrm_ps_employees", new[] { "national_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "race_national_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "religion_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "gender_seq" });
            DropIndex("dbo.hrm_ps_employees", new[] { "name_prefix_seq" });
            DropIndex("dbo.FimMasLookUp", new[] { "LookUpTypeId" });
            DropIndex("dbo.FimMasBankBranch", new[] { "BankId" });
            DropIndex("dbo.FimMasBankAccount", new[] { "WorkAreaId" });
            DropIndex("dbo.FimMasBankAccount", new[] { "AccountId" });
            DropIndex("dbo.FimMasBankAccount", new[] { "BankAccTypeId" });
            DropIndex("dbo.FimMasBankAccount", new[] { "SavingBankAccId" });
            DropIndex("dbo.FimMasBankAccount", new[] { "BgmSourceId" });
            DropIndex("dbo.FimMasBankAccount", new[] { "BranchId" });
            DropIndex("dbo.HrmMasScope", new[] { "MasScope_ScopeId" });
            DropIndex("dbo.HrmMasWorkArea", new[] { "ScopeId" });
            DropIndex("dbo.bgm_mas_source", new[] { "bgm_year_type_seq" });
            DropIndex("dbo.bgm_mas_source", new[] { "bgm_source_type_seq" });
            DropIndex("dbo.bgm_mas_source", new[] { "upper_bgm_source_seq" });
            DropIndex("dbo.FimTransfer", new[] { "EmpId" });
            DropIndex("dbo.FimTransfer", new[] { "ToBankAccId" });
            DropIndex("dbo.FimTransfer", new[] { "FromBankAccId" });
            DropIndex("dbo.FimTransfer", new[] { "WorkAreaId" });
            DropIndex("dbo.FimTransfer", new[] { "BgSourceId" });
            DropIndex("dbo.AcmTransection", new[] { "BgSourceId" });
            DropIndex("dbo.AcmTransection", new[] { "WorkAreaId" });
            DropIndex("dbo.AcmTransection", new[] { "TransferId" });
            DropIndex("dbo.AcmMasAccount", new[] { "VersionId" });
            DropIndex("dbo.AcmMasAccount", new[] { "UpperAccountId" });
            DropForeignKey("dbo.FimMasFund", "ConId", "dbo.IcmMasContact");
            DropForeignKey("dbo.FimEmployeeTax", "FundTypeId", "dbo.FimMasFund");
            DropForeignKey("dbo.FimEmployeeTax", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmPurchaseOrderPenalty", "RateTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseOrderPenalty", "PoId", "dbo.IcmPurchaseOrder");
            DropForeignKey("dbo.IcmDeliveryNotePenalty", "PoPenId", "dbo.IcmPurchaseOrderPenalty");
            DropForeignKey("dbo.IcmDeliveryNotePenalty", "DnId", "dbo.IcmDeliveryNote");
            DropForeignKey("dbo.FimReceive", "PayId", "dbo.FimPay");
            DropForeignKey("dbo.FimReceive", "PayReqId", "dbo.FimPayRequest");
            DropForeignKey("dbo.FimReceive", "PetitionId", "dbo.FimPetition");
            DropForeignKey("dbo.FimReceive", "TransferId", "dbo.FimTransfer");
            DropForeignKey("dbo.FimReceive", "TranGrpId", "dbo.AcmTransectionGroup");
            DropForeignKey("dbo.FimReceive", "PoInstalId", "dbo.IcmPurchaseOrderInstallment");
            DropForeignKey("dbo.FimReceive", "DnPenId", "dbo.IcmDeliveryNotePenalty");
            DropForeignKey("dbo.FimReceive", "PrePayColId", "dbo.IcmBidderCollateral");
            DropForeignKey("dbo.FimReceive", "PoColId", "dbo.IcmBidderCollateral");
            DropForeignKey("dbo.FimReceive", "BidOfferColId", "dbo.IcmBidderCollateral");
            DropForeignKey("dbo.FimReceive", "BidderId", "dbo.IcmBidder");
            DropForeignKey("dbo.FimReceive", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.FimReceive", "ContactId", "dbo.IcmMasContact");
            DropForeignKey("dbo.FimReceive", "BankAccId", "dbo.FimMasBankAccount");
            DropForeignKey("dbo.FimReceive", "BranchId", "dbo.FimMasBankBranch");
            DropForeignKey("dbo.FimReceive", "ReceiveMethodId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimReceive", "ReceiveTypeId", "dbo.FimMasReceiveType");
            DropForeignKey("dbo.FimReceive", "WorkAreaId", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.FimReceive", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimPayCheque", "ChequeId", "dbo.FimCheque");
            DropForeignKey("dbo.FimPayCheque", "PayId", "dbo.FimPay");
            DropForeignKey("dbo.FimPayRequestDtlRate", "PayRequestDtlId", "dbo.FimPayRequestDtl");
            DropForeignKey("dbo.FimCheque", "ChequeBookId", "dbo.FimChequeBook");
            DropForeignKey("dbo.FimChequeBook", "BankAccId", "dbo.FimMasBankAccount");
            DropForeignKey("dbo.FimMasBorrowType", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimMasReceiveType", "AccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.FimMasReceiveType", "BankAccId", "dbo.FimMasBankAccount");
            DropForeignKey("dbo.FimMasReceiveType", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimMasExpenseRate", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimMasExpenseRate", "BgExpId", "dbo.bgm_mas_expense");
            DropForeignKey("dbo.bgm_strategy_data_list", "bgm_strat_type_seq", "dbo.bgm_mas_strategy_type");
            DropForeignKey("dbo.IcmBidderCollateral", "BidderId", "dbo.IcmBidder");
            DropForeignKey("dbo.IcmBidderCollateral", "ColCategoryId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmBidderCollateral", "ColStatusId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmBidderCollateral", "ColTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.FimPay", "TranGrpId", "dbo.AcmTransectionGroup");
            DropForeignKey("dbo.FimPay", "PostPayId", "dbo.FimPay");
            DropForeignKey("dbo.FimPay", "BidderColId", "dbo.IcmBidderCollateral");
            DropForeignKey("dbo.FimPay", "ContactId", "dbo.IcmMasContact");
            DropForeignKey("dbo.FimPay", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.FimPay", "PetitionDtlId", "dbo.FimPetitionDtl");
            DropForeignKey("dbo.FimPay", "PetitionId", "dbo.FimPetition");
            DropForeignKey("dbo.FimPay", "PayReqId", "dbo.FimPayRequest");
            DropForeignKey("dbo.FimPay", "PayMethodId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimPay", "PayEventId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimPay", "WorkAreaId", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.FimPay", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimPetition", "TranGrpId", "dbo.AcmTransectionGroup");
            DropForeignKey("dbo.FimPetition", "PetitionTypeId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimPetition", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimPetitionDtl", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.FimPetitionDtl", "PayReqId", "dbo.FimPayRequest");
            DropForeignKey("dbo.FimPetitionDtl", "PetitionId", "dbo.FimPetition");
            DropForeignKey("dbo.FimReturn", "TranGrpId", "dbo.AcmTransectionGroup");
            DropForeignKey("dbo.FimReturn", "PayReqId", "dbo.FimPayRequest");
            DropForeignKey("dbo.FimReturnDtl", "PayReqDtlId", "dbo.FimPayRequestDtl");
            DropForeignKey("dbo.FimReturnDtl", "ReturnId", "dbo.FimReturn");
            DropForeignKey("dbo.FimPayRequest", "TranGrpId", "dbo.AcmTransectionGroup");
            DropForeignKey("dbo.FimPayRequest", "DebtorContactId", "dbo.IcmMasContact");
            DropForeignKey("dbo.FimPayRequest", "DebtorEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.FimPayRequest", "BorrowTypeId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimPayRequest", "DnId", "dbo.IcmDeliveryNote");
            DropForeignKey("dbo.FimPayRequest", "ContactId", "dbo.IcmMasContact");
            DropForeignKey("dbo.FimPayRequest", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.FimPayRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.FimPayRequest", "ProjOperId", "dbo.bgm_project_operation");
            DropForeignKey("dbo.FimPayRequest", "AdvanceBgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimPayRequest", "PayEventId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimPayRequest", "ExpGrpId", "dbo.bgm_mas_expense_group");
            DropForeignKey("dbo.FimPayRequest", "WorkAreaId", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.FimPayRequest", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimPayRequestDtl", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.FimPayRequestDtl", "ProjOperExpId", "dbo.bgm_project_operation_expense");
            DropForeignKey("dbo.FimPayRequestDtl", "PayReqId", "dbo.FimPayRequest");
            DropForeignKey("dbo.IcmWarehouse", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.IcmWarehouse", "ScopeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmDeliveryNote", "TranGrpId", "dbo.AcmTransectionGroup");
            DropForeignKey("dbo.IcmDeliveryNote", "ProgId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmDeliveryNote", "DeliveryJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.IcmDeliveryNote", "DeliveryEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmDeliveryNote", "YearTypeId", "dbo.sys_year_type");
            DropForeignKey("dbo.IcmDeliveryNote", "WhId", "dbo.IcmWarehouse");
            DropForeignKey("dbo.IcmDeliveryNote", "PoInstallId", "dbo.IcmPurchaseOrderInstallment");
            DropForeignKey("dbo.IcmDeliveryNote", "PoId", "dbo.IcmPurchaseOrder");
            DropForeignKey("dbo.IcmDeliveryNote", "ProjOperExpId", "dbo.bgm_project_operation_expense");
            DropForeignKey("dbo.IcmDeliveryNoteItem", "ResItemId", "dbo.IcmMasResourceItem");
            DropForeignKey("dbo.IcmDeliveryNoteItem", "PoInstallItemId", "dbo.IcmPurchaseOrderInstallmentItem");
            DropForeignKey("dbo.IcmDeliveryNoteItem", "DnId", "dbo.IcmDeliveryNote");
            DropForeignKey("dbo.IcmPurchaseOrder", "YearTypeId", "dbo.sys_year_type");
            DropForeignKey("dbo.IcmPurchaseOrder", "ProgressId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseOrder", "DurTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseOrder", "PcTypeId", "dbo.IcmMasPurchaseType");
            DropForeignKey("dbo.IcmPurchaseOrder", "BidderId", "dbo.IcmBidder");
            DropForeignKey("dbo.IcmPurchaseOrderInstallment", "DurTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseOrderInstallment", "PoId", "dbo.IcmPurchaseOrder");
            DropForeignKey("dbo.IcmBid", "CancelEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmBid", "ConfirmEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmBid", "BidJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.IcmBid", "BidEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmBid", "YearTypeId", "dbo.sys_year_type");
            DropForeignKey("dbo.IcmBid", "PrId", "dbo.IcmPurchaseRequest");
            DropForeignKey("dbo.IcmBidder", "VatTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmBidder", "DurTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmBidder", "PrId", "dbo.IcmPurchaseRequest");
            DropForeignKey("dbo.IcmBidder", "BidId", "dbo.IcmBid");
            DropForeignKey("dbo.IcmBidder", "ConId", "dbo.IcmMasContact");
            DropForeignKey("dbo.IcmBidderQuotation", "PrItemId", "dbo.IcmPurchaseRequestItem");
            DropForeignKey("dbo.IcmBidderQuotation", "BidderId", "dbo.IcmBidder");
            DropForeignKey("dbo.IcmPurchaseOrderInstallmentItem", "PoInstallId", "dbo.IcmPurchaseOrderInstallment");
            DropForeignKey("dbo.IcmPurchaseOrderInstallmentItem", "BidderQuoId", "dbo.IcmBidderQuotation");
            DropForeignKey("dbo.IcmMasPurchaseMethod", "PcTypeId", "dbo.IcmMasPurchaseType");
            DropForeignKey("dbo.IcmPurchaseRequest", "ProgressId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseRequest", "DurCountId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseRequest", "DurTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseRequest", "PriorityId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPurchaseRequest", "CancelEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmPurchaseRequest", "ConfirmEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmPurchaseRequest", "PurchaseJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.IcmPurchaseRequest", "PurchaseEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmPurchaseRequest", "YearTypeId", "dbo.sys_year_type");
            DropForeignKey("dbo.IcmPurchaseRequest", "PcMethodId", "dbo.IcmMasPurchaseMethod");
            DropForeignKey("dbo.IcmPurchaseRequest", "PcTypeId", "dbo.IcmMasPurchaseType");
            DropForeignKey("dbo.IcmPurchaseRequest", "RegularId", "dbo.IcmMasPurchaseRegular");
            DropForeignKey("dbo.IcmPurchaseRequestItem", "ResItemId", "dbo.IcmMasResourceItem");
            DropForeignKey("dbo.IcmPurchaseRequestItem", "BgExpId", "dbo.bgm_mas_expense");
            DropForeignKey("dbo.IcmPurchaseRequestItem", "PrId", "dbo.IcmPurchaseRequest");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "ProgressId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "DurCountId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "DurTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "PriorityId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "RequestJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "RequestEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "YearTypeId", "dbo.sys_year_type");
            DropForeignKey("dbo.IcmPrePurchaseRequest", "PcTypeId", "dbo.IcmMasPurchaseType");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "BgExpId", "dbo.bgm_mas_expense");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "PrItemId", "dbo.IcmPurchaseRequestItem");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "PprId", "dbo.IcmPrePurchaseRequest");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "ResItemId", "dbo.IcmMasResourceItem");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "RegularId", "dbo.IcmMasPurchaseRegular");
            DropForeignKey("dbo.IcmPrePurchaseRequestItem", "ProjOperExpId", "dbo.bgm_project_operation_expense");
            DropForeignKey("dbo.bgm_project_operation_report", "pay_seq", "dbo.FimPay");
            DropForeignKey("dbo.bgm_project_operation_report", "petition_dtls_seq", "dbo.FimPetitionDtl");
            DropForeignKey("dbo.bgm_project_operation_report", "return_dtls_seq", "dbo.FimReturnDtl");
            DropForeignKey("dbo.bgm_project_operation_report", "money_req_dtls_seq", "dbo.FimPayRequestDtl");
            DropForeignKey("dbo.bgm_project_operation_report", "icm_dn_item_seq", "dbo.IcmDeliveryNoteItem");
            DropForeignKey("dbo.bgm_project_operation_report", "icm_po_install_item_seq", "dbo.IcmPurchaseOrderInstallmentItem");
            DropForeignKey("dbo.bgm_project_operation_report", "icm_pr_item_seq", "dbo.IcmPurchaseRequestItem");
            DropForeignKey("dbo.bgm_project_operation_report", "icm_ppr_item_seq", "dbo.IcmPrePurchaseRequestItem");
            DropForeignKey("dbo.bgm_project_operation_report", "bgm_proj_oper_exp_seq", "dbo.bgm_project_operation_expense");
            DropForeignKey("dbo.IcmMasLookUp", "LookUpTypeId", "dbo.IcmMasLookUpType");
            DropForeignKey("dbo.IcmMasContact", "VatTypeId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmMasContact", "ConStatusId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.IcmMasContact", "ConGrpId", "dbo.IcmMasLookUp");
            DropForeignKey("dbo.bgm_project_operation_person", "ContactId", "dbo.IcmMasContact");
            DropForeignKey("dbo.bgm_project_operation_person", "emp_seq", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.bgm_project_operation_person", "bgm_proj_oper_seq", "dbo.bgm_project_operation");
            DropForeignKey("dbo.bgm_project_operation", "job_site_seq", "dbo.hrm_job_site");
            DropForeignKey("dbo.bgm_project_operation", "emp_seq", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.bgm_project_operation", "bgm_proj_seq", "dbo.bgm_project");
            DropForeignKey("dbo.bgm_project_operation_expense", "bgm_proj_exp_seq", "dbo.bgm_project_expense");
            DropForeignKey("dbo.bgm_project_operation_expense", "bgm_proj_oper_seq", "dbo.bgm_project_operation");
            DropForeignKey("dbo.bgm_project_report", "bgm_proj_oper_exp_seq", "dbo.bgm_project_operation_expense");
            DropForeignKey("dbo.bgm_project_report", "bgm_proj_exp_seq", "dbo.bgm_project_expense");
            DropForeignKey("dbo.bgm_mas_option", "bgm_option_type_seq", "dbo.bgm_system_option_type");
            DropForeignKey("dbo.bgm_mas_option", "job_site_seq", "dbo.hrm_job_site");
            DropForeignKey("dbo.bgm_mas_option", "upper_bgm_option_seq", "dbo.bgm_mas_option");
            DropForeignKey("dbo.bgm_project_option", "bgm_proj_seq", "dbo.bgm_project");
            DropForeignKey("dbo.bgm_project_option", "bgm_option_seq", "dbo.bgm_mas_option");
            DropForeignKey("dbo.bgm_project_manager", "emp_seq", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.bgm_project_manager", "bgm_proj_seq", "dbo.bgm_project");
            DropForeignKey("dbo.bgm_project_activity_plan", "bgm_proj_seq", "dbo.bgm_project");
            DropForeignKey("dbo.IcmMasResourceGroup", "CumdepreAccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.IcmMasResourceGroup", "ConsumeAccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.IcmMasResourceGroup", "BreakAccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.IcmMasResourceGroup", "DepreAccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.IcmMasResourceGroup", "AssetAccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.IcmMasResourceGroup", "DpTypeId", "dbo.IcmMasDepreciationType");
            DropForeignKey("dbo.IcmMasResourceGroup", "ResTypeId", "dbo.IcmMasResourceType");
            DropForeignKey("dbo.IcmMasResourceSubGroup", "DpTypeId", "dbo.IcmMasDepreciationType");
            DropForeignKey("dbo.IcmMasResourceSubGroup", "ResGrpId", "dbo.IcmMasResourceGroup");
            DropForeignKey("dbo.IcmMasResourceItem", "UnitId", "dbo.IcmMasUnit");
            DropForeignKey("dbo.IcmMasResourceItem", "ResSubGrpId", "dbo.IcmMasResourceSubGroup");
            DropForeignKey("dbo.bgm_project_expense", "icm_res_item_seq", "dbo.IcmMasResourceItem");
            DropForeignKey("dbo.bgm_project_expense", "bgm_exp_seq", "dbo.bgm_mas_expense");
            DropForeignKey("dbo.bgm_project_expense", "bgm_source_seq", "dbo.bgm_mas_source");
            DropForeignKey("dbo.bgm_project_expense", "bgm_proj_seq", "dbo.bgm_project");
            DropForeignKey("dbo.bgm_mas_expense_source", "bgm_source_seq", "dbo.bgm_mas_source");
            DropForeignKey("dbo.bgm_mas_expense_source", "bgm_exp_seq", "dbo.bgm_mas_expense");
            DropForeignKey("dbo.bgm_mas_expense", "account_seq", "dbo.AcmMasAccount");
            DropForeignKey("dbo.bgm_mas_expense", "bgm_exp_grp_id_real", "dbo.bgm_mas_expense_group");
            DropForeignKey("dbo.bgm_mas_expense", "bgm_exp_grp_seq", "dbo.bgm_mas_expense_group");
            DropForeignKey("dbo.bgm_mas_expense", "upper_bgm_exp_seq", "dbo.bgm_mas_expense");
            DropForeignKey("dbo.AcmTransectionDtl", "AccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.AcmTransectionDtl", "TranId", "dbo.AcmTransection");
            DropForeignKey("dbo.HrmFieldPosition", "PosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmFieldPosition", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMasCity", "CountryId", "dbo.HrmMasCountry");
            DropForeignKey("dbo.HrmMasAmphur", "ProvinceId", "dbo.HrmMasProvince");
            DropForeignKey("dbo.HrmMasDistrict", "AmphurId", "dbo.HrmMasAmphur");
            DropForeignKey("dbo.HrmMasJobSiteType", "CurrentJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.hrm_job_site", "JobSite_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.hrm_job_site", "job_site_status_seq", "dbo.HrmMasJobSiteStatus");
            DropForeignKey("dbo.hrm_job_site", "country_seq", "dbo.HrmMasCountry");
            DropForeignKey("dbo.hrm_job_site", "city_seq", "dbo.HrmMasCity");
            DropForeignKey("dbo.hrm_job_site", "provnce_seq", "dbo.HrmMasProvince");
            DropForeignKey("dbo.hrm_job_site", "district_seq", "dbo.HrmMasDistrict");
            DropForeignKey("dbo.hrm_job_site", "job_site_level_seq", "dbo.HrmMasJobSiteLevel");
            DropForeignKey("dbo.hrm_job_site", "work_area_seq", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.hrm_job_site", "job_site_type_seq", "dbo.HrmMasJobSiteType");
            DropForeignKey("dbo.hrm_job_site", "upper_job_site_seq", "dbo.hrm_job_site");
            DropForeignKey("dbo.hrm_position", "Position_PosId1", "dbo.hrm_position");
            DropForeignKey("dbo.hrm_position", "Position_PosId", "dbo.hrm_position");
            DropForeignKey("dbo.hrm_position", "pos_status_seq", "dbo.HrmMasPositionStatus");
            DropForeignKey("dbo.hrm_position", "emp_type_seq", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.hrm_position", "exec_pos_seq", "dbo.hrm_executive_position");
            DropForeignKey("dbo.hrm_position", "field_pos_seq", "dbo.HrmFieldPosition");
            DropForeignKey("dbo.hrm_position", "job_site_seq", "dbo.hrm_job_site");
            DropForeignKey("dbo.hrm_position", "working_upper_pos_seq", "dbo.hrm_position");
            DropForeignKey("dbo.hrm_position", "upper_pos_seq", "dbo.hrm_position");
            DropForeignKey("dbo.HrmMasPositionType", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.hrm_mas_class", "emp_type_seq", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.hrm_mas_class", "pos_type_seq", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.hrm_mas_employee_type", "year_type_seq", "dbo.sys_year_type");
            DropForeignKey("dbo.HrmMasNamePrefix", "GenderId", "dbo.hrm_mas_gender");
            DropForeignKey("dbo.hrm_ps_employees", "marital_status_seq", "dbo.hrm_mas_marital_status");
            DropForeignKey("dbo.hrm_ps_employees", "exec_pos_seq", "dbo.hrm_executive_position");
            DropForeignKey("dbo.hrm_ps_employees", "emp_status_seq", "dbo.hrm_mas_employee_status");
            DropForeignKey("dbo.hrm_ps_employees", "working_job_site_seq", "dbo.hrm_job_site");
            DropForeignKey("dbo.hrm_ps_employees", "pos_seq", "dbo.hrm_position");
            DropForeignKey("dbo.hrm_ps_employees", "class_seq", "dbo.hrm_mas_class");
            DropForeignKey("dbo.hrm_ps_employees", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.hrm_ps_employees", "national_seq", "dbo.hrm_mas_nationality");
            DropForeignKey("dbo.hrm_ps_employees", "race_national_seq", "dbo.hrm_mas_nationality");
            DropForeignKey("dbo.hrm_ps_employees", "religion_seq", "dbo.hrm_mas_religion");
            DropForeignKey("dbo.hrm_ps_employees", "gender_seq", "dbo.hrm_mas_gender");
            DropForeignKey("dbo.hrm_ps_employees", "name_prefix_seq", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.FimMasLookUp", "LookUpTypeId", "dbo.FimMasLookUpType");
            DropForeignKey("dbo.FimMasBankBranch", "BankId", "dbo.FimMasBank");
            DropForeignKey("dbo.FimMasBankAccount", "WorkAreaId", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.FimMasBankAccount", "AccountId", "dbo.AcmMasAccount");
            DropForeignKey("dbo.FimMasBankAccount", "BankAccTypeId", "dbo.FimMasLookUp");
            DropForeignKey("dbo.FimMasBankAccount", "SavingBankAccId", "dbo.FimMasBankAccount");
            DropForeignKey("dbo.FimMasBankAccount", "BgmSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimMasBankAccount", "BranchId", "dbo.FimMasBankBranch");
            DropForeignKey("dbo.HrmMasScope", "MasScope_ScopeId", "dbo.HrmMasScope");
            DropForeignKey("dbo.HrmMasWorkArea", "ScopeId", "dbo.HrmMasScope");
            DropForeignKey("dbo.bgm_mas_source", "bgm_year_type_seq", "dbo.sys_year_type");
            DropForeignKey("dbo.bgm_mas_source", "bgm_source_type_seq", "dbo.bgm_mas_source_type");
            DropForeignKey("dbo.bgm_mas_source", "upper_bgm_source_seq", "dbo.bgm_mas_source");
            DropForeignKey("dbo.FimTransfer", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.FimTransfer", "ToBankAccId", "dbo.FimMasBankAccount");
            DropForeignKey("dbo.FimTransfer", "FromBankAccId", "dbo.FimMasBankAccount");
            DropForeignKey("dbo.FimTransfer", "WorkAreaId", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.FimTransfer", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.AcmTransection", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.AcmTransection", "WorkAreaId", "dbo.HrmMasWorkArea");
            DropForeignKey("dbo.AcmTransection", "TransferId", "dbo.FimTransfer");
            DropForeignKey("dbo.AcmMasAccount", "VersionId", "dbo.AcmMasAccountVersion");
            DropForeignKey("dbo.AcmMasAccount", "UpperAccountId", "dbo.AcmMasAccount");
            DropTable("dbo.FimMasFund");
            DropTable("dbo.FimEmployeeTax");
            DropTable("dbo.IcmPurchaseOrderPenalty");
            DropTable("dbo.IcmDeliveryNotePenalty");
            DropTable("dbo.FimReceive");
            DropTable("dbo.FimPayCheque");
            DropTable("dbo.FimPayRequestDtlRate");
            DropTable("dbo.FimCheque");
            DropTable("dbo.FimChequeBook");
            DropTable("dbo.FimMasBorrowType");
            DropTable("dbo.FimMasReceiveType");
            DropTable("dbo.FimMasBankAccountTypeGroup");
            DropTable("dbo.FimMasBankAccountType");
            DropTable("dbo.FimMasExpenseRate");
            DropTable("dbo.bgm_system_control");
            DropTable("dbo.bgm_mas_strategy_type");
            DropTable("dbo.bgm_strategy_data_list");
            DropTable("dbo.bgm_project_type");
            DropTable("dbo.bgm_mas_scopes");
            DropTable("dbo.IcmBidderCollateral");
            DropTable("dbo.FimPay");
            DropTable("dbo.FimPetition");
            DropTable("dbo.FimPetitionDtl");
            DropTable("dbo.FimReturn");
            DropTable("dbo.FimReturnDtl");
            DropTable("dbo.FimPayRequest");
            DropTable("dbo.FimPayRequestDtl");
            DropTable("dbo.IcmWarehouse");
            DropTable("dbo.IcmDeliveryNote");
            DropTable("dbo.IcmDeliveryNoteItem");
            DropTable("dbo.IcmPurchaseOrder");
            DropTable("dbo.IcmPurchaseOrderInstallment");
            DropTable("dbo.IcmBid");
            DropTable("dbo.IcmBidder");
            DropTable("dbo.IcmBidderQuotation");
            DropTable("dbo.IcmPurchaseOrderInstallmentItem");
            DropTable("dbo.IcmMasPurchaseMethod");
            DropTable("dbo.IcmPurchaseRequest");
            DropTable("dbo.IcmPurchaseRequestItem");
            DropTable("dbo.IcmMasPurchaseType");
            DropTable("dbo.IcmPrePurchaseRequest");
            DropTable("dbo.IcmMasPurchaseRegular");
            DropTable("dbo.IcmPrePurchaseRequestItem");
            DropTable("dbo.bgm_project_operation_report");
            DropTable("dbo.IcmMasLookUpType");
            DropTable("dbo.IcmMasLookUp");
            DropTable("dbo.IcmMasContact");
            DropTable("dbo.bgm_project_operation_person");
            DropTable("dbo.bgm_project_operation");
            DropTable("dbo.bgm_project_operation_expense");
            DropTable("dbo.bgm_project_report");
            DropTable("dbo.bgm_system_option_type");
            DropTable("dbo.bgm_mas_option");
            DropTable("dbo.bgm_project_option");
            DropTable("dbo.bgm_project_manager");
            DropTable("dbo.bgm_project_activity_plan");
            DropTable("dbo.IcmMasUnit");
            DropTable("dbo.IcmMasDepreciationType");
            DropTable("dbo.IcmMasResourceType");
            DropTable("dbo.IcmMasResourceGroup");
            DropTable("dbo.IcmMasResourceSubGroup");
            DropTable("dbo.IcmMasResourceItem");
            DropTable("dbo.bgm_project_expense");
            DropTable("dbo.bgm_project");
            DropTable("dbo.bgm_mas_expense_source");
            DropTable("dbo.bgm_mas_expense_group");
            DropTable("dbo.bgm_mas_expense");
            DropTable("dbo.AcmTransectionGroup");
            DropTable("dbo.AcmTransectionDtl");
            DropTable("dbo.hrm_mas_marital_status");
            DropTable("dbo.hrm_mas_employee_status");
            DropTable("dbo.HrmMasPositionStatus");
            DropTable("dbo.hrm_executive_position");
            DropTable("dbo.HrmFieldPosition");
            DropTable("dbo.HrmMasJobSiteStatus");
            DropTable("dbo.HrmMasCountry");
            DropTable("dbo.HrmMasCity");
            DropTable("dbo.HrmMasProvince");
            DropTable("dbo.HrmMasAmphur");
            DropTable("dbo.HrmMasDistrict");
            DropTable("dbo.HrmMasJobSiteLevel");
            DropTable("dbo.HrmMasJobSiteType");
            DropTable("dbo.hrm_job_site");
            DropTable("dbo.hrm_position");
            DropTable("dbo.HrmMasPositionType");
            DropTable("dbo.hrm_mas_class");
            DropTable("dbo.hrm_mas_employee_type");
            DropTable("dbo.hrm_mas_nationality");
            DropTable("dbo.hrm_mas_religion");
            DropTable("dbo.hrm_mas_gender");
            DropTable("dbo.HrmMasNamePrefix");
            DropTable("dbo.hrm_ps_employees");
            DropTable("dbo.FimMasLookUpType");
            DropTable("dbo.FimMasLookUp");
            DropTable("dbo.FimMasBank");
            DropTable("dbo.FimMasBankBranch");
            DropTable("dbo.FimMasBankAccount");
            DropTable("dbo.HrmMasScope");
            DropTable("dbo.HrmMasWorkArea");
            DropTable("dbo.sys_year_type");
            DropTable("dbo.bgm_mas_source_type");
            DropTable("dbo.bgm_mas_source");
            DropTable("dbo.FimTransfer");
            DropTable("dbo.AcmTransection");
            DropTable("dbo.AcmMasFiscalPeriod");
            DropTable("dbo.AcmMasBaseAccount");
            DropTable("dbo.AcmMasAccounts");
            DropTable("dbo.AcmMasAccountVersion");
            DropTable("dbo.AcmMasAccount");
            DropTable("dbo.AcmChangeValue");
        }
    }
}
